Changeset View
Standalone View
src/dolphinmainwindow.cpp
Show First 20 Lines • Show All 60 Lines • ▼ Show 20 Line(s) | |||||
61 | #include <KRun> | 61 | #include <KRun> | ||
62 | #include <KShell> | 62 | #include <KShell> | ||
63 | #include <KStandardAction> | 63 | #include <KStandardAction> | ||
64 | #include <KToggleAction> | 64 | #include <KToggleAction> | ||
65 | #include <KToolBar> | 65 | #include <KToolBar> | ||
66 | #include <KToolInvocation> | 66 | #include <KToolInvocation> | ||
67 | #include <KUrlComboBox> | 67 | #include <KUrlComboBox> | ||
68 | #include <KUrlNavigator> | 68 | #include <KUrlNavigator> | ||
69 | #include <KWindowSystem> | ||||
69 | 70 | | |||
70 | #include <QApplication> | 71 | #include <QApplication> | ||
71 | #include <QClipboard> | 72 | #include <QClipboard> | ||
72 | #include <QCloseEvent> | 73 | #include <QCloseEvent> | ||
73 | #include <QDialog> | 74 | #include <QDialog> | ||
74 | #include <QFileInfo> | 75 | #include <QFileInfo> | ||
75 | #include <QLineEdit> | 76 | #include <QLineEdit> | ||
76 | #include <QMenu> | 77 | #include <QMenu> | ||
▲ Show 20 Lines • Show All 102 Lines • ▼ Show 20 Line(s) | 105 | { | |||
179 | connect(middleClickEventFilter, &MiddleClickActionEventFilter::actionMiddleClicked, this, &DolphinMainWindow::slotToolBarActionMiddleClicked); | 180 | connect(middleClickEventFilter, &MiddleClickActionEventFilter::actionMiddleClicked, this, &DolphinMainWindow::slotToolBarActionMiddleClicked); | ||
180 | toolBar()->installEventFilter(middleClickEventFilter); | 181 | toolBar()->installEventFilter(middleClickEventFilter); | ||
181 | } | 182 | } | ||
182 | 183 | | |||
183 | DolphinMainWindow::~DolphinMainWindow() | 184 | DolphinMainWindow::~DolphinMainWindow() | ||
184 | { | 185 | { | ||
185 | } | 186 | } | ||
186 | 187 | | |||
187 | void DolphinMainWindow::openDirectories(const QList<QUrl>& dirs, bool splitView) | 188 | void DolphinMainWindow::openDirectories(const QStringList& dirs, bool splitView) | ||
188 | { | 189 | { | ||
189 | m_tabWidget->openDirectories(dirs, splitView); | 190 | m_tabWidget->openDirectories(QUrl::fromStringList(dirs), splitView); | ||
190 | } | 191 | } | ||
191 | 192 | | |||
192 | void DolphinMainWindow::openFiles(const QList<QUrl>& files, bool splitView) | 193 | void DolphinMainWindow::openFiles(const QStringList& files, bool splitView) | ||
193 | { | 194 | { | ||
194 | m_tabWidget->openFiles(files, splitView); | 195 | m_tabWidget->openFiles(QUrl::fromStringList(files), splitView); | ||
elvisangelaccio: Coding style: we don't usually use `this->` since it's implicit. | |||||
196 | } | ||||
197 | | ||||
198 | void DolphinMainWindow::tryRaise() | ||||
199 | { | ||||
200 | KWindowSystem::forceActiveWindow( window()->effectiveWinId() ); | ||||
Please use KWindowSystem::activateWindow() instead. Normal applications are not supposed to call forceActiveWindow(). And I'd call this method activateWindow() as well, rather than tryRaise(). elvisangelaccio: Please use `KWindowSystem::activateWindow()` instead. Normal applications are not supposed to… | |||||
The problem with activateWindow() is that it doesn't raise the file manager - only a yellow background is put on the taskbar of the dolphin instance that the tab was opened to. In the current version of Dolphin, when we ask to open a folder in an external application a new instance of dolphin is opened, hence why it is raised to the top. For me not being able to raise the window to the top creates a bad UX as usually they want to see the folder they opened straight away, instead of having to click for the file manager after they've asked to see the folder. I think we should open this up for discussion. feverfew: The problem with `activateWindow()` is that it doesn't raise the file manager - only a yellow… | |||||
Well, the documentation is pretty clear: There are two ways how to activate a window, by calling activateWindow() and forceActiveWindow(). Generally, applications shouldn't make attempts to explicitly activate their windows, and instead let the user to activate them. In the special cases where this may be needed, applications should use activateWindow(). Window manager may consider whether this request wouldn't result in focus stealing, which would be obtrusive, and may refuse the request. The usage of forceActiveWindow() is meant only for pagers and similar tools, which represent direct user actions related to window manipulation. Except for rare cases, this request will be always honored, and normal applications are forbidden to use it. If this results in a bad UX, it should be probably addressed in plasma. elvisangelaccio: Well, the documentation is pretty clear:
```
There are two ways how to activate a window, by… | |||||
195 | } | 201 | } | ||
196 | 202 | | |||
197 | void DolphinMainWindow::showCommand(CommandType command) | 203 | void DolphinMainWindow::showCommand(CommandType command) | ||
198 | { | 204 | { | ||
199 | DolphinStatusBar* statusBar = m_activeViewContainer->statusBar(); | 205 | DolphinStatusBar* statusBar = m_activeViewContainer->statusBar(); | ||
200 | switch (command) { | 206 | switch (command) { | ||
201 | case KIO::FileUndoManager::Copy: | 207 | case KIO::FileUndoManager::Copy: | ||
202 | statusBar->setText(i18nc("@info:status", "Successfully copied.")); | 208 | statusBar->setText(i18nc("@info:status", "Successfully copied.")); | ||
▲ Show 20 Lines • Show All 1462 Lines • ▼ Show 20 Line(s) | 1670 | { | |||
1665 | DolphinMainWindow* mainWin= qobject_cast<DolphinMainWindow *>(parentWidget()); | 1671 | DolphinMainWindow* mainWin= qobject_cast<DolphinMainWindow *>(parentWidget()); | ||
1666 | if (mainWin) { | 1672 | if (mainWin) { | ||
1667 | DolphinViewContainer* container = mainWin->activeViewContainer(); | 1673 | DolphinViewContainer* container = mainWin->activeViewContainer(); | ||
1668 | container->showMessage(job->errorString(), DolphinViewContainer::Error); | 1674 | container->showMessage(job->errorString(), DolphinViewContainer::Error); | ||
1669 | } else { | 1675 | } else { | ||
1670 | KIO::FileUndoManager::UiInterface::jobError(job); | 1676 | KIO::FileUndoManager::UiInterface::jobError(job); | ||
1671 | } | 1677 | } | ||
1672 | } | 1678 | } | ||
1673 | 1679 | | |||
elvisangelaccio: Coding style: opening brace should go to next line | |||||
elvisangelaccio: We should use `QUrl::fromUserInput()` here. |
Coding style: we don't usually use this-> since it's implicit.