Changeset View
Standalone View
src/dolphinmainwindow.cpp
Show First 20 Lines • Show All 44 Lines • ▼ Show 20 Line(s) | |||||
45 | #include "views/viewproperties.h" | 45 | #include "views/viewproperties.h" | ||
46 | #include "views/dolphinnewfilemenuobserver.h" | 46 | #include "views/dolphinnewfilemenuobserver.h" | ||
47 | #include "dolphin_generalsettings.h" | 47 | #include "dolphin_generalsettings.h" | ||
48 | 48 | | |||
49 | #include <KActionCollection> | 49 | #include <KActionCollection> | ||
50 | #include <KActionMenu> | 50 | #include <KActionMenu> | ||
51 | #include <KAuthorized> | 51 | #include <KAuthorized> | ||
52 | #include <KConfig> | 52 | #include <KConfig> | ||
53 | #include <KConfigGui> | ||||
53 | #include <KDualAction> | 54 | #include <KDualAction> | ||
54 | #include <KFileItemListProperties> | 55 | #include <KFileItemListProperties> | ||
55 | #include <KHelpMenu> | 56 | #include <KHelpMenu> | ||
56 | #include <KIO/CommandLauncherJob> | 57 | #include <KIO/CommandLauncherJob> | ||
57 | #include <KIO/JobUiDelegate> | 58 | #include <KIO/JobUiDelegate> | ||
58 | #include <KIO/OpenFileManagerWindowJob> | 59 | #include <KIO/OpenFileManagerWindowJob> | ||
59 | #include <KJobWidgets> | 60 | #include <KJobWidgets> | ||
60 | #include <KLocalizedString> | 61 | #include <KLocalizedString> | ||
▲ Show 20 Lines • Show All 140 Lines • ▼ Show 20 Line(s) | 129 | #endif | |||
201 | auto *middleClickEventFilter = new MiddleClickActionEventFilter(this); | 202 | auto *middleClickEventFilter = new MiddleClickActionEventFilter(this); | ||
202 | connect(middleClickEventFilter, &MiddleClickActionEventFilter::actionMiddleClicked, this, &DolphinMainWindow::slotToolBarActionMiddleClicked); | 203 | connect(middleClickEventFilter, &MiddleClickActionEventFilter::actionMiddleClicked, this, &DolphinMainWindow::slotToolBarActionMiddleClicked); | ||
203 | toolBar()->installEventFilter(middleClickEventFilter); | 204 | toolBar()->installEventFilter(middleClickEventFilter); | ||
204 | 205 | | |||
205 | setupWhatsThis(); | 206 | setupWhatsThis(); | ||
206 | 207 | | |||
207 | QTimer::singleShot(0, this, &DolphinMainWindow::setupUpdateOpenPreferredSearchToolAction); | 208 | QTimer::singleShot(0, this, &DolphinMainWindow::setupUpdateOpenPreferredSearchToolAction); | ||
208 | } | 209 | } | ||
209 | 210 | | |||
broulik: Instead of hardcoding those settings everywhere, please use KConfigXt (the `kcfg` files you can… | |||||
you need to check you're not being loaded as part of a session restore otherwise you'll have two paths call readProperties qApp->isSessionRestored() davidedmundson: you need to check you're not being loaded as part of a session restore otherwise you'll have… | |||||
210 | DolphinMainWindow::~DolphinMainWindow() | 211 | DolphinMainWindow::~DolphinMainWindow() | ||
211 | { | 212 | { | ||
212 | } | 213 | } | ||
213 | 214 | | |||
I'm surprised this works at all. AFAICTL it'll never be empty as the instance will find itself and hence won't be empty, unless our DBus interface isn't initialised yet (tbf I don't know when it would be). Either way I don't see why this instance is preferred so I think the code would be clearer if it was simply QString() instead. feverfew: I'm surprised this works at all. AFAICTL it'll never be empty as the instance will find itself… | |||||
It doesn't find itself because Dolphin::dolphinInstanceData() filters out the currently running instance by excludinv entries that match its PID. ngraham: It doesn't find itself because `Dolphin::dolphinInstanceData()` filters out the currently… | |||||
The reason why preferredService was a parameter was for when ShowFolders/ShowItems was called via DBus. It specifically bypasses excluding the running instance as in that case you wanted the running instance to accept those URLs, i.e. marking a sevice as preferred means it is exempt from the check that filters out the currently running instance. In this case you want to see if any other instances (apart from this one) exist, and hence you should be passing QString(). The only reason I can think of why the patch works in this current state is that Q_CLASSINFO macro only initialises the DBus object for the main window after the constructor finishes... feverfew: The reason why `preferredService` was a parameter was for when `ShowFolders`/`ShowItems` was… | |||||
214 | QVector<DolphinViewContainer*> DolphinMainWindow::viewContainers() const | 215 | QVector<DolphinViewContainer*> DolphinMainWindow::viewContainers() const | ||
215 | { | 216 | { | ||
216 | QVector<DolphinViewContainer*> viewContainers; | 217 | QVector<DolphinViewContainer*> viewContainers; | ||
217 | viewContainers.reserve(m_tabWidget->count()); | 218 | viewContainers.reserve(m_tabWidget->count()); | ||
218 | for (int i = 0; i < m_tabWidget->count(); ++i) { | 219 | for (int i = 0; i < m_tabWidget->count(); ++i) { | ||
elvisangelaccio: Please move this logic in `DolphinMainWindow::closeEvent()`. | |||||
219 | viewContainers << m_tabWidget->tabPageAt(i)->activeViewContainer(); | 220 | viewContainers << m_tabWidget->tabPageAt(i)->activeViewContainer(); | ||
220 | } | 221 | } | ||
221 | return viewContainers; | 222 | return viewContainers; | ||
222 | } | 223 | } | ||
223 | 224 | | |||
224 | void DolphinMainWindow::openDirectories(const QList<QUrl>& dirs, bool splitView) | 225 | void DolphinMainWindow::openDirectories(const QList<QUrl>& dirs, bool splitView) | ||
225 | { | 226 | { | ||
226 | m_tabWidget->openDirectories(dirs, splitView); | 227 | m_tabWidget->openDirectories(dirs, splitView); | ||
▲ Show 20 Lines • Show All 348 Lines • ▼ Show 20 Line(s) | 574 | case QDialogButtonBox::No: | |||
575 | // Do not quit, ignore quit event | 576 | // Do not quit, ignore quit event | ||
576 | Q_FALLTHROUGH(); | 577 | Q_FALLTHROUGH(); | ||
577 | default: | 578 | default: | ||
578 | event->ignore(); | 579 | event->ignore(); | ||
579 | return; | 580 | return; | ||
580 | } | 581 | } | ||
581 | } | 582 | } | ||
582 | 583 | | |||
584 | if (GeneralSettings::rememberOpenedTabs()) { | ||||
585 | KConfigGui::setSessionConfig(QStringLiteral("dolphin"), QStringLiteral("dolphin")); | ||||
586 | KConfig *config = KConfigGui::sessionConfig(); | ||||
587 | saveGlobalProperties(config); | ||||
588 | savePropertiesInternal(config, 1); | ||||
589 | config->sync(); | ||||
590 | } | ||||
591 | | ||||
583 | GeneralSettings::setVersion(CurrentDolphinVersion); | 592 | GeneralSettings::setVersion(CurrentDolphinVersion); | ||
584 | GeneralSettings::self()->save(); | 593 | GeneralSettings::self()->save(); | ||
585 | 594 | | |||
586 | KXmlGuiWindow::closeEvent(event); | 595 | KXmlGuiWindow::closeEvent(event); | ||
587 | } | 596 | } | ||
588 | 597 | | |||
589 | void DolphinMainWindow::saveProperties(KConfigGroup& group) | 598 | void DolphinMainWindow::saveProperties(KConfigGroup& group) | ||
590 | { | 599 | { | ||
▲ Show 20 Lines • Show All 1772 Lines • Show Last 20 Lines |
Instead of hardcoding those settings everywhere, please use KConfigXt (the kcfg files you can see for other places in Dolphin), like GeneralSettings