Procházet zdrojové kódy

重命名判断逻辑错误。
导出项目,项目管理无项目时,灰选。

MaiXinRong před 9 roky
rodič
revize
078c3d1d3e
2 změnil soubory, kde provedl 19 přidání a 8 odebrání
  1. 1 0
      Frames/ProjectManagerFme.dfm
  2. 18 8
      Frames/ProjectManagerFme.pas

+ 1 - 0
Frames/ProjectManagerFme.dfm

@@ -476,6 +476,7 @@ object ProjectManagerFrame: TProjectManagerFrame
       Caption = #23548#20986
       ImageIndex = 17
       OnExecute = actnExportExecute
+      OnUpdate = actnExportUpdate
     end
     object actnOpenBackupFolder: TAction
       Caption = #26597#30475#22791#20221#25968#25454

+ 18 - 8
Frames/ProjectManagerFme.pas

@@ -86,6 +86,7 @@ type
     procedure actnRenameUpdate(Sender: TObject);
     procedure zgProjectsShowHint(var HintStr: String; var CanShow: Boolean;
       var HintInfo: THintInfo; const ACoord: TPoint);
+    procedure actnExportUpdate(Sender: TObject);
   private
     FProjectManagerData: TProjectManagerData;
 
@@ -1407,15 +1408,19 @@ var
   Rec: TsdDataRecord;
   bNet: Boolean;
 begin
-  if stdProjects.IDTree.Selected = nil then Exit;
-  Rec := stdProjects.IDTree.Selected.Rec;
-  if Rec = nil then Exit;
-  bNet := G_IsCloud;
-  if bNet then
+  if Assigned(stdProjects.IDTree.Selected) and Assigned(stdProjects.IDTree.Selected.Rec) then
   begin
-    tobtnRenane.Enabled := (Rec.ValueByName('Type').AsInteger = 1) and
-      (Rec.ValueByName('WebAuthorID').AsInteger = PHPWeb.UserID);
-  end;
+    tobtnRenane.Enabled := True;
+    Rec := stdProjects.IDTree.Selected.Rec;
+    bNet := G_IsCloud;
+    if bNet then
+    begin
+      tobtnRenane.Enabled := (Rec.ValueByName('Type').AsInteger = 1) and
+        (Rec.ValueByName('WebAuthorID').AsInteger = PHPWeb.UserID);
+    end;
+  end
+  else
+    tobtnRenane.Enabled := False;
 end;
 
 procedure TProjectManagerFrame.CheckBidName(AID: Integer; ANewBidName: string);
@@ -1718,4 +1723,9 @@ begin
   end;
 end;
 
+procedure TProjectManagerFrame.actnExportUpdate(Sender: TObject);
+begin
+  TToolButton(Sender).Enabled := Assigned(stdProjects.IDTree.Selected);
+end;
+
 end.