Relicense all GPLv2 only code to GPLv2+.
[kdenetwork.git] / kget / mainwindow.h
blobc3763bf93440d2ac19022cade5ad0aaf3b2fd116
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;
48 KSystemTrayIcon *systemTray() const { return m_dock;};
50 public slots:
51 void slotQuit();
53 protected:
54 // ignore/accept quit events
55 virtual void closeEvent( QCloseEvent * );
57 // drag and drop
58 virtual void dragEnterEvent(QDragEnterEvent *);
59 virtual void dropEvent(QDropEvent *);
61 private slots:
62 // slots connected to actions
63 void slotToggleDropTarget();
64 void slotNewTransfer();
65 void slotImportTransfers();
66 void slotExportTransfers();
67 void slotPreferences();
68 void slotDeleteGroup();
69 void slotRenameGroup();
70 void slotStartDownload();
71 void slotStopDownload();
72 void slotConfigureNotifications();
73 void slotConfigureKeys();
74 void slotConfigureToolbars();
75 void slotToggleAutoPaste();
76 void slotTrayKonquerorIntegration(bool);
77 void slotKonquerorIntegration( bool );
78 void slotShowMenubar();
80 // transfers slots
81 void slotStopAllDownload();
82 void slotStopSelectedDownload();
83 void slotStartAllDownload();
84 void slotStartSelectedDownload();
85 void slotDeleteSelected();
86 void slotTransfersOpenDest();
87 void slotTransfersShowDetails();
88 void slotTransfersCopySourceUrl();
90 // misc slots
91 void slotDelayedInit();
92 void slotSaveMyself();
93 void slotNewToolbarConfig();
94 void slotNewConfig();
95 void slotCheckClipboard();
97 private:
98 // one-time functions
99 void setupActions();
101 // internal widgets
102 ViewsContainer * m_viewsContainer;
103 // dbus modelObserver to export the transfer percents
104 DBusModelObserver *m_dbusModelObserver;
106 // separated widgets
107 DropTarget * m_drop;
108 Tray * m_dock;
110 // actions
111 KToggleAction * m_autoPasteAction;
112 KToggleAction * m_menubarAction;
113 KToggleAction * m_konquerorIntegration;
115 // for autopaste function
116 QString lastClipboard;
117 // timer for checking clipboard - autopaste function
118 QTimer *clipboardTimer;
120 bool m_startWithoutAnimation;
123 #endif