* major layout fixes (size, stacked widget, ...)
[kdenetwork.git] / kget / mainwindow.h
blob8e96fb52cb1256a2542bdc7ba82c9f161977aef1
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;
25 class HttpServer;
27 /**
28 * The main window of KGet.
30 * Can be collapsed or expanded.
32 class MainWindow : public KXmlGuiWindow
34 Q_OBJECT
35 public:
36 explicit MainWindow(bool showMainwindow = true, bool startWithoutAnimation = false, QWidget *parent = 0);
37 ~MainWindow();
39 // from the DBUS interface
40 virtual void addTransfers(const QString& src, const QString& destDir = QString(),
41 bool start = false);
42 virtual bool dropTargetVisible() const;
43 virtual void setDropTargetVisible( bool setVisible );
44 virtual void setOfflineMode( bool online );
45 virtual bool offlineMode() const;
46 virtual QVariantMap transfers() const;
47 virtual int transfersSpeed() const;
48 virtual void setSystemTrayDownloading(bool running);
49 virtual void importLinks(const QList <QString> &links);
51 KSystemTrayIcon *systemTray() const { return m_dock;};
53 public slots:
54 void slotQuit();
55 void slotImportUrl(const QString &url);
57 protected:
58 // ignore/accept quit events
59 virtual void closeEvent( QCloseEvent * );
61 // drag and drop
62 virtual void dragEnterEvent(QDragEnterEvent *);
63 virtual void dropEvent(QDropEvent *);
65 // set sensitive initial size
66 virtual QSize sizeHint() const;
68 private slots:
69 // slots connected to actions
70 void slotToggleDropTarget();
71 void slotNewTransfer();
72 void slotImportTransfers();
73 void slotExportTransfers();
74 void slotPreferences();
75 void slotDeleteGroup();
76 void slotRenameGroup();
77 void slotSetIconGroup();
78 void slotStartDownload();
79 void slotStopDownload();
80 void slotConfigureNotifications();
81 void slotConfigureKeys();
82 void slotConfigureToolbars();
83 void slotToggleAutoPaste();
84 void slotTrayKonquerorIntegration(bool);
85 void slotKonquerorIntegration( bool );
86 void slotShowMenubar();
87 void slotTransferGroupSettings();
88 void slotTransferSettings();
90 // transfers slots
91 void slotStopAllDownload();
92 void slotStopSelectedDownload();
93 void slotStartAllDownload();
94 void slotStartSelectedDownload();
95 void slotDeleteSelected();
96 void slotRedownloadSelected();
97 void slotTransfersOpenDest();
98 void slotTransfersOpenFile();
99 void slotTransfersShowDetails();
100 void slotTransfersCopySourceUrl();
101 void slotDeleteFinished();
103 // misc slots
104 void slotDelayedInit();
105 void slotSaveMyself();
106 void slotNewToolbarConfig();
107 void slotNewConfig();
108 void slotCheckClipboard();
109 void slotTransferHistory();
111 // import links slots
112 void slotShowListLinks();
114 private:
115 // one-time functions
116 void setupActions();
118 // internal widgets
119 ViewsContainer * m_viewsContainer;
120 // dbus modelObserver to export the transfer percents
121 DBusModelObserver *m_dbusModelObserver;
123 // separated widgets
124 DropTarget * m_drop;
125 Tray * m_dock;
127 // actions
128 KToggleAction * m_autoPasteAction;
129 KToggleAction * m_menubarAction;
130 KToggleAction * m_konquerorIntegration;
132 // for autopaste function
133 QString lastClipboard;
134 // timer for checking clipboard - autopaste function
135 QTimer *clipboardTimer;
137 bool m_startWithoutAnimation;
139 HttpServer *m_webinterface;
142 #endif