Changeset 3


Ignore:
Timestamp:
Jan 14, 2018, 10:48:21 PM (4 years ago)
Author:
chronos
Message:
  • Modified: Prepared context menu actions for Services list.
Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Languages/OpenTaskManager.cs.po

    r2 r3  
    1313
    1414#: tformmain.aalwaysontop.caption
    15 #, fuzzy
    1615msgctxt "tformmain.aalwaysontop.caption"
    1716msgid "Always on top"
     
    2726
    2827#: tformmain.arun.caption
    29 #, fuzzy
    3028msgctxt "tformmain.arun.caption"
    3129msgid "Run new task"
    3230msgstr "Spustit novou úlohu"
    3331
     32#: tformmain.aservicerestart.caption
     33msgctxt "tformmain.aservicerestart.caption"
     34msgid "Restart"
     35msgstr "Restartovat"
     36
     37#: tformmain.aservicestart.caption
     38msgid "Start"
     39msgstr "Spustit"
     40
     41#: tformmain.aservicestop.caption
     42msgctxt "tformmain.aservicestop.caption"
     43msgid "Stop"
     44msgstr "Zastavit"
     45
    3446#: tformmain.caption
    3547msgid "Open Task Manager"
     
    3749
    3850#: tformmain.listviewdetails.columns[0].caption
    39 #, fuzzy
    4051msgctxt "tformmain.listviewdetails.columns[0].caption"
    4152msgid "Name"
     
    5768
    5869#: tformmain.listviewdetails.columns[4].caption
    59 #, fuzzy
    6070msgctxt "tformmain.listviewdetails.columns[4].caption"
    6171msgid "Processor"
     
    6373
    6474#: tformmain.listviewdetails.columns[5].caption
    65 #, fuzzy
    6675msgctxt "tformmain.listviewdetails.columns[5].caption"
    6776msgid "Memory"
     
    7483
    7584#: tformmain.listviewonstartup.columns[0].caption
    76 #, fuzzy
    7785msgctxt "tformmain.listviewonstartup.columns[0].caption"
    7886msgid "Name"
     
    93101
    94102#: tformmain.listviewprocesses.columns[0].caption
    95 #, fuzzy
    96103msgctxt "tformmain.listviewprocesses.columns[0].caption"
    97104msgid "Name"
     
    99106
    100107#: tformmain.listviewprocesses.columns[1].caption
    101 #, fuzzy
    102108msgctxt "tformmain.listviewprocesses.columns[1].caption"
    103109msgid "Processor"
     
    105111
    106112#: tformmain.listviewprocesses.columns[2].caption
    107 #, fuzzy
    108113msgctxt "tformmain.listviewprocesses.columns[2].caption"
    109114msgid "Memory"
     
    111116
    112117#: tformmain.listviewprocesses.columns[3].caption
    113 #, fuzzy
    114118msgctxt "tformmain.listviewprocesses.columns[3].caption"
    115119msgid "Drive"
     
    117121
    118122#: tformmain.listviewprocesses.columns[4].caption
    119 #, fuzzy
    120123msgctxt "tformmain.listviewprocesses.columns[4].caption"
    121124msgid "Network"
     
    123126
    124127#: tformmain.listviewservices.columns[0].caption
    125 #, fuzzy
    126128msgctxt "tformmain.listviewservices.columns[0].caption"
    127129msgid "Name"
     
    174176
    175177#: tformmain.menuitem19.caption
    176 #, fuzzy
    177178msgctxt "tformmain.menuitem19.caption"
    178179msgid "High"
     
    188189
    189190#: tformmain.menuitem21.caption
    190 #, fuzzy
    191191msgctxt "tformmain.menuitem21.caption"
    192192msgid "Normal"
     
    198198
    199199#: tformmain.menuitem23.caption
    200 #, fuzzy
    201200msgctxt "tformmain.menuitem23.caption"
    202201msgid "Low"
     
    240239
    241240#: tformmain.menuitem33.caption
     241msgctxt "tformmain.menuitem33.caption"
    242242msgid "Restart"
    243243msgstr "Restartovat"
     
    253253
    254254#: tformmain.menuitem37.caption
     255msgctxt "tformmain.menuitem37.caption"
    255256msgid "Go to details"
    256257msgstr "Přejít na detaily"
     
    274275msgstr "Vlastnosti"
    275276
     277#: tformmain.menuitem45.caption
     278msgid "Open Services window"
     279msgstr "Otevřít okno Služby"
     280
     281#: tformmain.menuitem46.caption
     282msgctxt "tformmain.menuitem46.caption"
     283msgid "Search online"
     284msgstr "Hledat online"
     285
     286#: tformmain.menuitem47.caption
     287msgctxt "tformmain.menuitem47.caption"
     288msgid "Go to details"
     289msgstr "Přejít na detaily"
     290
    276291#: tformmain.menuitem5.caption
    277292msgid "Minimalize on use"
     
    324339
    325340#: uformmain.srunnewtask
    326 #, fuzzy
    327341msgctxt "uformmain.srunnewtask"
    328342msgid "Run new task"
  • trunk/Languages/OpenTaskManager.po

    r2 r3  
    2020msgstr ""
    2121
     22#: tformmain.aservicerestart.caption
     23msgctxt "tformmain.aservicerestart.caption"
     24msgid "Restart"
     25msgstr ""
     26
     27#: tformmain.aservicestart.caption
     28msgid "Start"
     29msgstr ""
     30
     31#: tformmain.aservicestop.caption
     32msgctxt "tformmain.aservicestop.caption"
     33msgid "Stop"
     34msgstr ""
     35
    2236#: tformmain.caption
    2337msgid "Open Task Manager"
     
    215229
    216230#: tformmain.menuitem33.caption
     231msgctxt "tformmain.menuitem33.caption"
    217232msgid "Restart"
    218233msgstr ""
     
    228243
    229244#: tformmain.menuitem37.caption
     245msgctxt "tformmain.menuitem37.caption"
    230246msgid "Go to details"
    231247msgstr ""
     
    249265msgstr ""
    250266
     267#: tformmain.menuitem45.caption
     268msgid "Open Services window"
     269msgstr ""
     270
     271#: tformmain.menuitem46.caption
     272msgctxt "tformmain.menuitem46.caption"
     273msgid "Search online"
     274msgstr ""
     275
     276#: tformmain.menuitem47.caption
     277msgctxt "tformmain.menuitem47.caption"
     278msgid "Go to details"
     279msgstr ""
     280
    251281#: tformmain.menuitem5.caption
    252282msgid "Minimalize on use"
  • trunk/UFormMain.lfm

    r2 r3  
    2020    ActivePage = TabSheetServices
    2121    Align = alClient
     22    PopupMenu = PopupMenuServices
    2223    TabIndex = 6
    2324    TabOrder = 0
     
    269270      OnExecute = ARestoreExecute
    270271      Visible = False
     272    end
     273    object AServiceStop: TAction
     274      Caption = 'Stop'
     275      OnExecute = AServiceStopExecute
     276    end
     277    object AServiceRestart: TAction
     278      Caption = 'Restart'
     279      OnExecute = AServiceRestartExecute
     280    end
     281    object AServiceStart: TAction
     282      Caption = 'Start'
     283      OnExecute = AServiceStartExecute
    271284    end
    272285  end
     
    46704683    end
    46714684  end
     4685  object PopupMenuServices: TPopupMenu
     4686    OnPopup = PopupMenuServicesPopup
     4687    left = 712
     4688    top = 104
     4689    object MenuItem41: TMenuItem
     4690      Action = AServiceStart
     4691    end
     4692    object MenuItem42: TMenuItem
     4693      Action = AServiceStop
     4694    end
     4695    object MenuItem43: TMenuItem
     4696      Action = AServiceRestart
     4697    end
     4698    object MenuItem44: TMenuItem
     4699      Caption = '-'
     4700    end
     4701    object MenuItem45: TMenuItem
     4702      Caption = 'Open Services window'
     4703    end
     4704    object MenuItem46: TMenuItem
     4705      Caption = 'Search online'
     4706    end
     4707    object MenuItem47: TMenuItem
     4708      Caption = 'Go to details'
     4709    end
     4710  end
    46724711end
  • trunk/UFormMain.pas

    r2 r3  
    4141  TFormMain = class(TForm)
    4242    AAlwaysOnTop: TAction;
     43    AServiceStart: TAction;
     44    AServiceRestart: TAction;
     45    AServiceStop: TAction;
    4346    ARestore: TAction;
    4447    ARun: TAction;
     
    8689    MenuItem4: TMenuItem;
    8790    MenuItem40: TMenuItem;
     91    MenuItem41: TMenuItem;
     92    MenuItem42: TMenuItem;
     93    MenuItem43: TMenuItem;
     94    MenuItem44: TMenuItem;
     95    MenuItem45: TMenuItem;
     96    MenuItem46: TMenuItem;
     97    MenuItem47: TMenuItem;
    8898    MenuItem5: TMenuItem;
    8999    MenuItem6: TMenuItem;
     
    95105    PageControl1: TPageControl;
    96106    Panel1: TPanel;
     107    PopupMenuServices: TPopupMenu;
    97108    PopupMenuProcesses: TPopupMenu;
    98109    PopupMenuDetails: TPopupMenu;
     
    110121    procedure ARestoreExecute(Sender: TObject);
    111122    procedure ARunExecute(Sender: TObject);
     123    procedure AServiceRestartExecute(Sender: TObject);
     124    procedure AServiceStartExecute(Sender: TObject);
     125    procedure AServiceStopExecute(Sender: TObject);
    112126    procedure FormCreate(Sender: TObject);
    113127    procedure FormDestroy(Sender: TObject);
     
    118132    procedure ListViewServicesData(Sender: TObject; Item: TListItem);
    119133    procedure PageControl1Change(Sender: TObject);
     134    procedure PopupMenuServicesPopup(Sender: TObject);
    120135    procedure TimerRefreshTimer(Sender: TObject);
    121136    procedure TrayIcon1Click(Sender: TObject);
     
    144159
    145160  var
    146     SystemServiceStatusText: array [TSystemServiceState] of string = ('Running', 'Stopped');
     161    SystemServiceStatusText: array [TSystemServiceState] of string = ('Stopped', 'Running');
    147162{ TFormMain }
    148163
     
    176191end;
    177192
     193procedure TFormMain.AServiceRestartExecute(Sender: TObject);
     194begin
     195  if Assigned(ListViewServices.Selected) then begin
     196    ExecuteAnWaitForOutput('/bin/systemctl', ['restart',
     197      TSystemService(ListViewServices.Selected.Data).Name])
     198  end;
     199end;
     200
     201procedure TFormMain.AServiceStartExecute(Sender: TObject);
     202begin
     203  ExecuteAnWaitForOutput('/bin/systemctl', ['start',
     204    TSystemService(ListViewServices.Selected.Data).Name])
     205end;
     206
     207procedure TFormMain.AServiceStopExecute(Sender: TObject);
     208begin
     209  ExecuteAnWaitForOutput('/bin/systemctl', ['stop',
     210    TSystemService(ListViewServices.Selected.Data).Name])
     211end;
     212
    178213procedure TFormMain.FormCreate(Sender: TObject);
    179214begin
     
    204239  if Item.Index < Processes.Count then
    205240  with TSystemProcess(Processes[Item.Index]) do begin
     241    Item.Data := Processes[Item.Index];
    206242    Item.Caption := Name;
    207243    Item.SubItems.Add(IntToStr(PID));
     
    218254  if Item.Index < Processes.Count then
    219255  with TSystemProcess(Processes[Item.Index]) do begin
     256    Item.Data := Processes[Item.Index];
    220257    Item.Caption := Name;
    221258    Item.SubItems.Add(FloatToStr(Cpu));
     
    230267  if Item.Index < Services.Count then
    231268  with TSystemService(Services[Item.Index]) do begin
     269    Item.Data := Services[Item.Index];
    232270    Item.Caption := Name;
    233271    Item.SubItems.Add('');
     
    241279begin
    242280  ReloadTab;
     281end;
     282
     283procedure TFormMain.PopupMenuServicesPopup(Sender: TObject);
     284begin
     285  AServiceRestart.Enabled := Assigned(ListViewServices.Selected) and
     286    (TSystemService(ListViewServices.Selected.Data).State = ssRunning);
     287  AServiceStop.Enabled := Assigned(ListViewServices.Selected) and
     288    (TSystemService(ListViewServices.Selected.Data).State = ssRunning);
     289  AServiceStart.Enabled := Assigned(ListViewServices.Selected) and
     290    (TSystemService(ListViewServices.Selected.Data).State = ssStopped);
    243291end;
    244292
Note: See TracChangeset for help on using the changeset viewer.