Fix system-tray...
[kdenetwork.git] / kget / mainwindow.h
blobeebeeb338efcd2b7b676035084df1211cdda2f49
1 /* This file is part of the KDE project
3 Copyright (C) 2002 by Patrick Charbonnier <pch@freeshell.org>
4 Based On Caitoo v.0.7.3 (c) 1998 - 2000, Matej Koss
5 Copyright (C) 2006 Dario Massarin <nekkar@libero.it>
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public
9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version.
13 #ifndef MAINWINDOW_H
14 #define MAINWINDOW_H
16 #include <ktoggleaction.h>
17 #include <kxmlguiwindow.h>
18 #include <kurl.h>
20 #include "ui/tray.h"
22 class ViewsContainer;
23 class DropTarget;
24 class DBusModelObserver;
26 /**
27 * The main window of KGet.
29 * Can be collapsed or expanded.
31 class MainWindow : public KXmlGuiWindow
33 Q_OBJECT
34 public:
35 explicit MainWindow(bool showMainwindow = true, bool startWithoutAnimation = false, QWidget *parent = 0);
36 ~MainWindow();
38 // from the DBUS interface
39 virtual void addTransfers(const QString& src, const QString& destDir = QString(),
40 bool start = false);
41 virtual bool dropTargetVisible() const;
42 virtual void setDropTargetVisible( bool setVisible );
43 virtual void setOfflineMode( bool online );
44 virtual bool offlineMode() const;
45 virtual QVariantMap transfers() const;
46 virtual int transfersSpeed() const;
47 virtual void setTrayDownloading(bool running);
49 KSystemTrayIcon *systemTray() const { return m_dock;};
51 public slots:
52 void slotQuit();
54 protected:
55 // ignore/accept quit events
56 virtual void closeEvent( QCloseEvent * );
58 // drag and drop
59 virtual void dragEnterEvent(QDragEnterEvent *);
60 virtual void dropEvent(QDropEvent *);
62 private slots:
63 // slots connected to actions
64 void slotToggleDropTarget();
65 void slotNewTransfer();
66 void slotImportTransfers();
67 void slotExportTransfers();
68 void slotPreferences();
69 void slotDeleteGroup();
70 void slotRenameGroup();
71 void slotStartDownload();
72 void slotStopDownload();
73 void slotConfigureNotifications();
74 void slotConfigureKeys();
75 void slotConfigureToolbars();
76 void slotToggleAutoPaste();
77 void slotTrayKonquerorIntegration(bool);
78 void slotKonquerorIntegration( bool );
79 void slotShowMenubar();
81 // transfers slots
82 void slotStopAllDownload();
83 void slotStopSelectedDownload();
84 void slotStartAllDownload();
85 void slotStartSelectedDownload();
86 void slotDeleteSelected();
87 void slotTransfersOpenDest();
88 void slotTransfersShowDetails();
89 void slotTransfersCopySourceUrl();
91 // misc slots
92 void slotDelayedInit();
93 void slotSaveMyself();
94 void slotNewToolbarConfig();
95 void slotNewConfig();
96 void slotCheckClipboard();
98 private:
99 // one-time functions
100 void setupActions();
102 // internal widgets
103 ViewsContainer * m_viewsContainer;
104 // dbus modelObserver to export the transfer percents
105 DBusModelObserver *m_dbusModelObserver;
107 // separated widgets
108 DropTarget * m_drop;
109 Tray * m_dock;
111 // actions
112 KToggleAction * m_autoPasteAction;
113 KToggleAction * m_menubarAction;
114 KToggleAction * m_konquerorIntegration;
116 // for autopaste function
117 QString lastClipboard;
118 // timer for checking clipboard - autopaste function
119 QTimer *clipboardTimer;
121 bool m_startWithoutAnimation;
124 #endif