1 //***************************************************************************
2 //   Copyright 2006 - 2017 Martin Koller, kollix@aon.at
3 //
4 //   This program is free software; you can redistribute it and/or modify
5 //   it under the terms of the GNU General Public License as published by
6 //   the Free Software Foundation, version 2 of the License
7 //
8 //***************************************************************************
9 
10 #ifndef _MAIN_WINDOW_H_
11 #define _MAIN_WINDOW_H_
12 
13 #include <kxmlguiwindow.h>
14 
15 class Selector;
16 class MainWidget;
17 class KStatusNotifierItem;
18 class KToggleAction;
19 class QAction;
20 class KRecentFilesAction;
21 class QUrl;
22 class QSplitter;
23 
24 class MainWindow : public KXmlGuiWindow
25 {
26   Q_OBJECT
27 
28   public:
29     MainWindow();
30     void loadProfile(const QString &fileName, bool adaptTreeWidth = false);
31 
32     // start backup and quit application after it's finished
33     void runBackup();
34 
35   protected:
36     bool queryClose() override;
37 
38   private Q_SLOTS:
39     void loadProfile();
40     void saveProfileAs();
41     void saveProfile(QString fileName = QString());
42     void profileSettings();
43     void newProfile();
44     void loggingSlot(const QString &message);
45     void changeSystrayTip();
46     void inProgress(bool);
47     void dockInSysTray(bool checked);
48     void showHiddenFiles(bool checked);
49     void maybeQuit();
50     void recentProfileSelected(const QUrl &url);
51     void enableAllMessages();
52 
53   private:
54     bool stopAllowed();
55     void setLoadedProfile(const QString &name);
56 
57   private:
58     QSplitter *splitter = nullptr;
59     Selector *selector = nullptr;
60     MainWidget *mainWidget = nullptr;
61     KStatusNotifierItem *sysTray = nullptr;
62     QString lastLog;
63     QAction *startBackupAction = nullptr;
64     QAction *cancelBackupAction = nullptr;
65     QAction *quitAction = nullptr;
66     KRecentFilesAction *recentFiles = nullptr;
67     bool autorun = false;
68     QString loadedProfile;
69 };
70 
71 #endif
72