do not quit the app when it has been minimized to system tray and a new transfer...
[kdenetwork.git] / kget / mainwindow.cpp
blob3bf6107cf3c9f0af6e27bdf7d96d1c58bc683be3
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) 2002 Carsten Pfeiffer <pfeiffer@kde.org>
6 Copyright (C) 2006, 2007 Urs Wolfer <uwolfer @ kde.org>
7 Copyright (C) 2006 Dario Massarin <nekkar@libero.it>
9 This program is free software; you can redistribute it and/or
10 modify it under the terms of the GNU General Public
11 License as published by the Free Software Foundation; either
12 version 2 of the License, or (at your option) any later version.
15 #include "mainwindow.h"
17 #include "core/kget.h"
18 #include "core/transferhandler.h"
19 #include "core/transfergrouphandler.h"
20 #include "dbus/dbusmodelobserver.h"
21 #include "settings.h"
22 #include "conf/preferencesdialog.h"
23 #include "ui/viewscontainer.h"
24 #include "ui/tray.h"
25 #include "ui/droptarget.h"
26 #include "ui/newtransferdialog.h"
27 #include "ui/transferhistory.h"
29 #include <kapplication.h>
30 #include <kstandarddirs.h>
31 #include <KInputDialog>
32 #include <kmessagebox.h>
33 #include <kshortcutsdialog.h>
34 #include <kedittoolbar.h>
35 #include <knotifyconfigwidget.h>
36 #include <kfiledialog.h>
37 #include <ktoolinvocation.h>
38 #include <kmenubar.h>
39 #include <kiconloader.h>
40 #include <kstandardaction.h>
41 #include <klocale.h>
42 #include <kicon.h>
43 #include <kactionmenu.h>
44 #include <krun.h>
46 #include <QClipboard>
47 #include <QTimer>
49 MainWindow::MainWindow(bool showMainwindow, bool startWithoutAnimation, QWidget *parent)
50 : KXmlGuiWindow( parent ),
51 m_drop(0), m_dock(0), m_startWithoutAnimation(startWithoutAnimation)
53 // do not quit the app when it has been minimized to system tray and a new transfer dialog
54 // gets opened and closed again.
55 qApp->setQuitOnLastWindowClosed(false);
57 // create the model
58 KGet::self( this );
60 // create actions
61 setupActions();
63 createGUI("kgetui.rc");
65 m_viewsContainer = new ViewsContainer(this);
66 // initialize the model observer to export percents over dbus
67 m_dbusModelObserver = new DBusModelObserver();
69 setCentralWidget(m_viewsContainer);
71 // restore position, size and visibility
72 move( Settings::mainPosition() );
73 setAutoSaveSettings();
74 setPlainCaption(i18n("KGet"));
76 if ( Settings::showMain() && showMainwindow)
77 show();
78 else
79 hide();
81 //Some of the widgets are initialized in slotDelayedInit()
82 QTimer::singleShot( 0, this, SLOT(slotDelayedInit()) );
85 MainWindow::~MainWindow()
87 //Save the user's transfers
88 KGet::save();
90 slotSaveMyself();
91 delete clipboardTimer;
92 delete m_drop;
93 delete m_dock;
94 // reset konqueror integration (necessary if user enabled / disabled temporarily integration from tray)
95 slotKonquerorIntegration( Settings::konquerorIntegration() );
96 // the following call saves options set in above dtors
97 Settings::self()->writeConfig();
100 QSize MainWindow::sizeHint() const
102 return QSize(720, 380);
105 void MainWindow::setupActions()
107 QAction *newDownloadAction = actionCollection()->addAction("new_download");
108 newDownloadAction->setText(i18n("&New Download..."));
109 newDownloadAction->setIcon(KIcon("document-new"));
110 newDownloadAction->setShortcuts(KShortcut("Ctrl+N"));
111 connect(newDownloadAction, SIGNAL(triggered()), SLOT(slotNewTransfer()));
113 QAction *openAction = actionCollection()->addAction("import_transfers");
114 openAction->setText(i18n("&Import Transfers..."));
115 openAction->setIcon(KIcon("document-open"));
116 openAction->setShortcuts(KShortcut("Ctrl+I"));
117 connect(openAction, SIGNAL(triggered()), SLOT(slotImportTransfers()));
119 QAction *exportAction = actionCollection()->addAction("export_transfers");
120 exportAction->setText(i18n("&Export Transfers List..."));
121 exportAction->setIcon(KIcon("document-export"));
122 exportAction->setShortcuts(KShortcut("Ctrl+E"));
123 connect(exportAction, SIGNAL(triggered()), SLOT(slotExportTransfers()));
125 QAction *deleteGroupAction = actionCollection()->addAction("delete_groups");
126 deleteGroupAction->setText(i18n("Delete Group"));
127 deleteGroupAction->setIcon(KIcon("edit-delete"));
128 connect(deleteGroupAction, SIGNAL(triggered()), SLOT(slotDeleteGroup()));
130 QAction *renameGroupAction = actionCollection()->addAction("rename_groups");
131 renameGroupAction->setText(i18n("Rename Group"));
132 renameGroupAction->setIcon(KIcon("edit-rename"));
133 connect(renameGroupAction, SIGNAL(triggered()), SLOT(slotRenameGroup()));
135 m_autoPasteAction = new KToggleAction(KIcon("edit-paste"),
136 i18n("Auto-Paste Mode"), actionCollection());
137 actionCollection()->addAction("auto_paste", m_autoPasteAction);
138 m_autoPasteAction->setChecked(Settings::autoPaste());
139 m_autoPasteAction->setWhatsThis(i18n("<b>Auto paste</b> button toggles the auto-paste mode "
140 "on and off.\nWhen set, KGet will periodically scan "
141 "the clipboard for URLs and paste them automatically."));
142 connect(m_autoPasteAction, SIGNAL(triggered()), SLOT(slotToggleAutoPaste()));
144 m_konquerorIntegration = new KToggleAction(KIcon("konqueror"),
145 i18n("Use KGet as Konqueror Download Manager"), actionCollection());
146 actionCollection()->addAction("konqueror_integration", m_konquerorIntegration);
147 connect(m_konquerorIntegration, SIGNAL(triggered(bool)), SLOT(slotTrayKonquerorIntegration(bool)));
148 m_konquerorIntegration->setChecked(Settings::konquerorIntegration());
150 // local - Destroys all sub-windows and exits
151 QAction *quitAction = KStandardAction::quit(this, SLOT(slotQuit()), actionCollection());
152 actionCollection()->addAction("quit", quitAction);
153 // local - Standard configure actions
154 QAction *preferencesAction = KStandardAction::preferences(this, SLOT(slotPreferences()), actionCollection());
155 actionCollection()->addAction("preferences", preferencesAction);
156 QAction *configToolbarAction = KStandardAction::configureToolbars(this, SLOT(slotConfigureToolbars()), actionCollection());
157 actionCollection()->addAction("configure_toolbars", configToolbarAction);
158 QAction *keyBindingsAction = KStandardAction::keyBindings(this, SLOT(slotConfigureKeys()), actionCollection());
159 actionCollection()->addAction("configure_keys", keyBindingsAction);
160 QAction *cinfigNotifyAction = KStandardAction::configureNotifications(this, SLOT(slotConfigureNotifications()), actionCollection());
161 actionCollection()->addAction("configure_notifications", cinfigNotifyAction);
162 m_menubarAction = KStandardAction::showMenubar(this, SLOT(slotShowMenubar()), actionCollection());
163 m_menubarAction->setChecked(!menuBar()->isHidden());
164 actionCollection()->addAction("settings_showmenubar", m_menubarAction);
166 // Transfer related actions
167 QAction *deleteSelectedAction = actionCollection()->addAction("delete_selected_download");
168 deleteSelectedAction->setText(i18nc("delete selected transfer item", "Delete Selected"));
169 deleteSelectedAction->setIcon(KIcon("edit-delete"));
170 deleteSelectedAction->setShortcuts(KShortcut("Del"));
171 connect(deleteSelectedAction, SIGNAL(triggered()), SLOT(slotDeleteSelected()));
173 QAction *startAllAction = actionCollection()->addAction("start_all_download");
174 startAllAction->setText(i18n("Start / Resume All"));
175 startAllAction->setIcon(KIcon("media-seek-forward"));
176 startAllAction->setShortcuts(KShortcut("Ctrl+R"));
177 connect(startAllAction, SIGNAL(triggered()), SLOT(slotStartAllDownload()));
179 QAction *startSelectedAction = actionCollection()->addAction("start_selected_download");
180 startSelectedAction->setText(i18n("Start / Resume Selected"));
181 startSelectedAction->setIcon(KIcon("media-playback-start"));
182 connect(startSelectedAction, SIGNAL(triggered()), SLOT(slotStartSelectedDownload()));
184 QAction *stopAllAction = actionCollection()->addAction("stop_all_download");
185 stopAllAction->setText(i18n("Stop All"));
186 stopAllAction->setIcon(KIcon("media-playback-pause"));
187 stopAllAction->setShortcuts(KShortcut("Ctrl+P"));
188 connect(stopAllAction, SIGNAL(triggered()), SLOT(slotStopAllDownload()));
190 QAction *stopSelectedAction = actionCollection()->addAction("stop_selected_download");
191 stopSelectedAction->setText(i18n("Stop Selected"));
192 stopSelectedAction->setIcon(KIcon("media-playback-pause"));
193 connect(stopSelectedAction, SIGNAL(triggered()), SLOT(slotStopSelectedDownload()));
195 KActionMenu *startActionMenu = new KActionMenu(KIcon("media-playback-start"), i18n("Start / Resume"),
196 actionCollection());
197 actionCollection()->addAction("start_menu", startActionMenu);
198 startActionMenu->setDelayed(true);
199 startActionMenu->addAction(startAllAction);
200 startActionMenu->addAction(startSelectedAction);
201 connect(startActionMenu, SIGNAL(triggered()), SLOT(slotStartDownload()));
203 KActionMenu *stopActionMenu = new KActionMenu(KIcon("media-playback-pause"), i18n("Stop"),
204 actionCollection());
205 actionCollection()->addAction("stop_menu", stopActionMenu);
206 stopActionMenu->setDelayed(true);
207 stopActionMenu->addAction(stopAllAction);
208 stopActionMenu->addAction(stopSelectedAction);
209 connect(stopActionMenu, SIGNAL(triggered()), SLOT(slotStopDownload()));
211 QAction *openDestAction = actionCollection()->addAction("transfer_open_dest");
212 openDestAction->setText(i18n("Open Destination"));
213 openDestAction->setIcon(KIcon("document-open"));
214 connect(openDestAction, SIGNAL(triggered()), SLOT(slotTransfersOpenDest()));
216 QAction *openFileAction = actionCollection()->addAction("transfer_open_file");
217 openFileAction->setText(i18n("Open File"));
218 openFileAction->setIcon(KIcon("document-open"));
219 connect(openFileAction, SIGNAL(triggered()), SLOT(slotTransfersOpenFile()));
221 QAction *showDetailsAction = actionCollection()->addAction("transfer_show_details");
222 showDetailsAction->setText(i18n("Show Details"));
223 showDetailsAction->setIcon(KIcon("document-properties"));
224 connect(showDetailsAction, SIGNAL(triggered()), SLOT(slotTransfersShowDetails()));
226 QAction *copyUrlAction = actionCollection()->addAction("transfer_copy_source_url");
227 copyUrlAction->setText(i18n("Copy URL to Clipboard"));
228 copyUrlAction->setIcon(KIcon("edit-copy"));
229 connect(copyUrlAction, SIGNAL(triggered()), SLOT(slotTransfersCopySourceUrl()));
231 KToggleAction *showDropTargetAction = new KToggleAction(KIcon("kget"),
232 i18n("Show Drop Target"), actionCollection());
233 actionCollection()->addAction("show_drop_target", showDropTargetAction);
234 showDropTargetAction->setChecked(Settings::showDropTarget());
235 connect(showDropTargetAction, SIGNAL(triggered()), SLOT(slotToggleDropTarget()));
237 QAction *transferHistoryAction = actionCollection()->addAction("Transfer History");
238 transferHistoryAction->setText(i18n("&Transfer History"));
239 transferHistoryAction->setIcon(KIcon("view-history"));
240 transferHistoryAction->setShortcuts(KShortcut("Ctrl+H"));
241 connect(transferHistoryAction, SIGNAL(triggered()), SLOT(slotTransferHistory()));
244 void MainWindow::slotDelayedInit()
246 //Here we import the user's transfers.
247 KGet::load( KStandardDirs::locateLocal("appdata", "transfers.kgt") );
249 m_dock = new Tray(this);
250 if(Settings::enableSystemTray()) {
251 // DockWidget
252 m_dock->show();
255 // enable dropping
256 setAcceptDrops(true);
258 // enable hide toolbar
259 setStandardToolBarMenuEnabled(true);
261 // session management stuff
262 connect(kapp, SIGNAL(saveYourself()), SLOT(slotSaveMyself()));
264 // set auto-resume in kioslaverc (is there a cleaner way?)
265 KConfig cfg("kioslaverc", KConfig::NoGlobals);
266 cfg.group(QString()).writeEntry("AutoResume", true);
267 cfg.sync();
269 // immediately start downloading if configured this way
270 if ( Settings::downloadAtStartup() )
271 slotStartDownload();
273 // DropTarget
274 m_drop = new DropTarget(this);
276 if (Settings::firstRun()) {
277 if (KMessageBox::questionYesNoCancel(this ,i18n("This is the first time you have run KGet.\n"
278 "Would you like to enable KGet as the download manager for Konqueror?"),
279 i18n("Konqueror Integration"), KGuiItem(i18n("Enable")),
280 KGuiItem(i18n("Do Not Enable")))
281 == KMessageBox::Yes) {
282 Settings::setKonquerorIntegration(true);
283 slotKonquerorIntegration(true);
286 m_drop->setDropTargetVisible(true);
288 // reset the FirstRun config option
289 Settings::setFirstRun(false);
292 if (Settings::showDropTarget() && !m_startWithoutAnimation)
293 m_drop->setDropTargetVisible(true);
295 //auto paste stuff
296 lastClipboard = QApplication::clipboard()->text( QClipboard::Clipboard ).trimmed();
297 clipboardTimer = new QTimer(this);
298 connect(clipboardTimer, SIGNAL(timeout()), SLOT(slotCheckClipboard()));
299 if ( Settings::autoPaste() )
300 clipboardTimer->start(1000);
303 void MainWindow::slotToggleDropTarget()
305 actionCollection()->action("show_drop_target")->setChecked(!m_drop->isVisible());
307 m_drop->setDropTargetVisible(!m_drop->isVisible());
310 void MainWindow::slotNewTransfer()
312 NewTransferDialog::showNewTransferDialog();
315 void MainWindow::slotImportTransfers()
317 QString filename = KFileDialog::getOpenFileName(KUrl(),
318 "*.kgt *.metalink *.torrent|" + i18n("All Openable Files") +
319 " (*.kgt *.metalink *.torrent)", this, i18n("Open File"));
321 if(filename.endsWith(".kgt"))
323 KGet::load(filename);
324 return;
327 if(!filename.isEmpty())
328 KGet::addTransfer( KUrl( filename ) );
331 void MainWindow::slotQuit()
333 if (KGet::schedulerRunning()) {
334 if (KMessageBox::warningYesNoCancel(this,
335 i18n("Some transfers are still running.\n"
336 "Are you sure you want to close KGet?"),
337 i18n("Confirm Quit"),
338 KStandardGuiItem::yes(), KStandardGuiItem::no(), KStandardGuiItem::cancel(),
339 "ExitWithActiveTransfers") != KMessageBox::Yes)
340 return;
342 KGet::setSchedulerRunning(false);
345 Settings::self()->writeConfig();
346 qApp->quit();
349 void MainWindow::slotPreferences()
351 // an instance the dialog could be already created and could be cached,
352 // in which case you want to display the cached dialog
353 if ( PreferencesDialog::showDialog( "preferences" ) )
354 return;
356 // we didn't find an instance of this dialog, so lets create it
357 PreferencesDialog * dialog = new PreferencesDialog( this, Settings::self() );
358 KGet::setPluginsSettingsWidget( dialog->pluginsWidget() );
359 // keep us informed when the user changes settings
360 connect( dialog, SIGNAL(settingsChanged(const QString&)),
361 this, SLOT(slotNewConfig()) );
363 dialog->show();
366 void MainWindow::slotExportTransfers()
368 QString filename = KFileDialog::getSaveFileName
369 (KUrl(),
370 "*.kgt|" + i18n("KGet Transfer List") + " (*.kgt)",
371 this,
372 i18n("Export Transfers")
375 if(!filename.isEmpty())
376 KGet::save(filename);
379 void MainWindow::slotDeleteGroup()
381 foreach(TransferGroupHandler * it, KGet::selectedTransferGroups())
383 it->stop();
384 KGet::delGroup(it->name());
388 void MainWindow::slotRenameGroup()
390 bool ok = true;
391 QString groupName;
393 foreach(TransferGroupHandler * it, KGet::selectedTransferGroups())
395 groupName = KInputDialog::getText(i18n("Enter Group Name"),
396 i18n("Group name:"), it->name(), &ok, this);
397 if(ok)
398 it->setName(groupName);
402 void MainWindow::slotStartDownload()
404 if(KGet::selectedTransfers().size() == 0)
405 slotStartAllDownload();
406 else
407 slotStartSelectedDownload();
410 void MainWindow::slotStartAllDownload()
412 KGet::setSchedulerRunning(true);
415 void MainWindow::slotStartSelectedDownload()
417 foreach(TransferHandler * it, KGet::selectedTransfers())
418 it->start();
421 void MainWindow::slotStopDownload()
423 if(KGet::selectedTransfers().size() == 0)
424 slotStopAllDownload();
425 else
426 slotStopSelectedDownload();
429 void MainWindow::slotStopAllDownload()
431 KGet::setSchedulerRunning(false);
434 void MainWindow::slotStopSelectedDownload()
436 foreach (TransferHandler * it, KGet::selectedTransfers())
437 it->stop();
440 void MainWindow::slotDeleteSelected()
442 foreach(TransferHandler * it, KGet::selectedTransfers())
444 it->stop();
445 m_viewsContainer->closeTransferDetails(it);
446 KGet::delTransfer(it);
450 void MainWindow::slotTransfersOpenDest()
452 QStringList openedDirs;
453 foreach(TransferHandler * it, KGet::selectedTransfers())
455 QString directory = it->dest().directory();
456 if( !openedDirs.contains( directory ) )
458 new KRun(directory, this, 0, true, false);
459 openedDirs.append( directory );
464 void MainWindow::slotTransfersOpenFile()
466 foreach(TransferHandler * it, KGet::selectedTransfers())
468 new KRun(it->dest(), this, 0, true, false);
472 void MainWindow::slotTransfersShowDetails()
474 foreach(TransferHandler * it, KGet::selectedTransfers())
476 m_viewsContainer->showTransferDetails(it);
480 void MainWindow::slotTransfersCopySourceUrl()
482 foreach(TransferHandler * it, KGet::selectedTransfers())
484 QString sourceurl = it->source().url();
485 QClipboard *cb = QApplication::clipboard();
486 cb->setText(sourceurl, QClipboard::Selection);
487 cb->setText(sourceurl, QClipboard::Clipboard);
491 void MainWindow::slotConfigureNotifications()
493 KNotifyConfigWidget::configure(this);
496 void MainWindow::slotConfigureKeys()
498 KShortcutsDialog::configure(actionCollection());
501 void MainWindow::slotConfigureToolbars()
503 KEditToolBar edit( actionCollection() );
504 connect(&edit, SIGNAL( newToolbarConfig() ), this, SLOT( slotNewToolbarConfig() ));
505 edit.exec();
509 void MainWindow::slotSaveMyself()
511 // save last parameters ..
512 Settings::setMainPosition( pos() );
513 // .. and write config to disk
514 Settings::self()->writeConfig();
517 void MainWindow::slotNewToolbarConfig()
519 createGUI();
522 void MainWindow::slotNewConfig()
524 // Update here properties modified in the config dialog and not
525 // parsed often by the code. When clicking Ok or Apply of
526 // PreferencesDialog, this function is called.
528 m_viewsContainer->setExpandableDetails(Settings::showExpandableTransferDetails());
529 m_drop->setDropTargetVisible(Settings::showDropTarget(), false);
530 m_dock->setVisible(Settings::enableSystemTray());
531 if(!Settings::enableSystemTray()) setVisible(true);
533 slotKonquerorIntegration(Settings::konquerorIntegration());
534 m_konquerorIntegration->setChecked(Settings::konquerorIntegration());
536 KGet::reloadKJobs();
538 if (Settings::autoPaste())
539 clipboardTimer->start(1000);
540 else
541 clipboardTimer->stop();
542 m_autoPasteAction->setChecked(Settings::autoPaste());
544 KGet::settingsChanged();
547 void MainWindow::slotToggleAutoPaste()
549 bool autoPaste = !Settings::autoPaste();
550 Settings::setAutoPaste( autoPaste );
552 if (autoPaste)
553 clipboardTimer->start(1000);
554 else
555 clipboardTimer->stop();
556 m_autoPasteAction->setChecked(autoPaste);
559 void MainWindow::slotCheckClipboard()
561 QString clipData = QApplication::clipboard()->text( QClipboard::Clipboard ).trimmed();
563 if (clipData != lastClipboard)
565 lastClipboard = clipData;
566 if (lastClipboard.isEmpty())
567 return;
569 KUrl url = KUrl(lastClipboard);
571 if (url.isValid() && !url.isLocalFile())
572 KGet::addTransfer( url );
576 void MainWindow::slotTrayKonquerorIntegration(bool enable)
578 slotKonquerorIntegration(enable);
579 if (!enable && Settings::konquerorIntegration() && !Settings::expertMode())
581 KMessageBox::information(this,
582 i18n("KGet has been temporarily disabled as download manager for Konqueror. "
583 "If you want to disable it forever, go to Settings->Advanced and disable \"Use "
584 "as download manager for Konqueror\"."),
585 i18n("Konqueror Integration disabled"),
586 "KonquerorIntegrationDisabled");
590 void MainWindow::slotKonquerorIntegration(bool konquerorIntegration)
592 KConfig cfgKonqueror("konquerorrc", KConfig::NoGlobals);
593 cfgKonqueror.group("HTML Settings").writeEntry("DownloadManager",
594 QString(konquerorIntegration ? "kget" : QString()));
595 cfgKonqueror.sync();
598 void MainWindow::slotShowMenubar()
600 if (m_menubarAction->isChecked())
601 menuBar()->show();
602 else
603 menuBar()->hide();
606 void MainWindow::setSystemTrayDownloading(bool running)
608 kDebug(5001);
610 m_dock->setDownloading(running);
613 void MainWindow::slotTransferHistory()
615 TransferHistory *history = new TransferHistory();
616 history->exec();
619 /** widget events */
621 void MainWindow::closeEvent( QCloseEvent * e )
623 e->ignore();
624 if(!Settings::enableSystemTray()) {
625 slotQuit();
627 else {
628 hide();
632 void MainWindow::dragEnterEvent(QDragEnterEvent * event)
634 event->setAccepted(KUrl::List::canDecode(event->mimeData())
635 || event->mimeData()->hasText());
638 void MainWindow::dropEvent(QDropEvent * event)
640 KUrl::List list = KUrl::List::fromMimeData(event->mimeData());
641 QString str;
643 if (!list.isEmpty())
645 if (list.count() == 1 && list.first().url().endsWith(".kgt"))
647 int msgBoxResult = KMessageBox::questionYesNoCancel(this, "The dropped file is a KGet-Transferlist", "KGet",
648 KGuiItem(i18n("&Download"), KIcon("document-save")),
649 KGuiItem(i18n("&Load transferlist"), KIcon("list-add")), KStandardGuiItem::cancel());
651 if (msgBoxResult == 3) //Download
652 NewTransferDialog::showNewTransferDialog(list.first().url());
653 if (msgBoxResult == 4) //Load
654 KGet::load(list.first().url());
656 else
658 if (list.count() == 1)
660 str = event->mimeData()->text();
661 NewTransferDialog::showNewTransferDialog(str);
663 else
664 NewTransferDialog::showNewTransferDialog(list);
667 else
669 NewTransferDialog::showNewTransferDialog();
674 /** DBUS interface */
676 void MainWindow::addTransfers(const QString& src, const QString& dest, bool start)
678 // split src for the case it is a QStringList (e.g. from konqueror plugin)
679 KGet::addTransfer(src.split(";"), dest, QString(), start);
682 bool MainWindow::dropTargetVisible() const
684 return m_drop->isVisible();
687 void MainWindow::setDropTargetVisible( bool setVisible )
689 if ( setVisible != Settings::showDropTarget() )
690 m_drop->setDropTargetVisible( setVisible );
693 void MainWindow::setOfflineMode( bool offline )
695 KGet::setSchedulerRunning(offline);
698 bool MainWindow::offlineMode() const
700 return !KGet::schedulerRunning();
703 QVariantMap MainWindow::transfers() const
705 return m_dbusModelObserver->transfers();
708 int MainWindow::transfersSpeed() const
710 return m_dbusModelObserver->transfersSpeed();
713 #include "mainwindow.moc"