#endif
#include "dolphin_generalsettings.h"
-#include "dolphin_iconsmodesettings.h"
#include "dolphin_searchsettings.h"
#include <KAcceleratorManager>
namespace {
// Used for GeneralSettings::version() to determine whether
// an updated version of Dolphin is running.
- const int CurrentDolphinVersion = 171;
+ const int CurrentDolphinVersion = 200;
};
/*
const DolphinSettings& settings = DolphinSettings::instance();
GeneralSettings* generalSettings = settings.generalSettings();
- const bool firstRun = generalSettings->firstRun();
+ const bool firstRun = (generalSettings->version() < 200);
if (firstRun) {
generalSettings->setViewPropsTimestamp(QDateTime::currentDateTime());
}
const int tabCount = m_viewTab.count();
for (int i = 0; i < tabCount; ++i) {
m_viewTab[i].primaryView->view()->markUrlsAsSelected(files);
+ m_viewTab[i].primaryView->view()->markUrlAsCurrent(files.at(0));
if (m_viewTab[i].secondaryView) {
m_viewTab[i].secondaryView->view()->markUrlsAsSelected(files);
+ m_viewTab[i].secondaryView->view()->markUrlAsCurrent(files.at(0));
}
}
}
const int index = urlNavigator->historyIndex();
QAction* backAction = actionCollection()->action("go_back");
- backAction->setToolTip(i18nc("@info", "Go back"));
if (backAction) {
+ backAction->setToolTip(i18nc("@info", "Go back"));
backAction->setEnabled(index < urlNavigator->historySize() - 1);
}
QAction* forwardAction = actionCollection()->action("go_forward");
- forwardAction->setToolTip(i18nc("@info", "Go forward"));
if (forwardAction) {
+ forwardAction->setToolTip(i18nc("@info", "Go forward"));
forwardAction->setEnabled(index > 0);
}
}
}
}
- generalSettings->setFirstRun(false);
generalSettings->setVersion(CurrentDolphinVersion);
-
settings.save();
if (m_searchDockIsTemporaryVisible) {
#endif
}
-void DolphinMainWindow::openContextMenu(const KFileItem& item,
+void DolphinMainWindow::openContextMenu(const QPoint& pos,
+ const KFileItem& item,
const KUrl& url,
const QList<QAction*>& customActions)
{
- QPointer<DolphinContextMenu> contextMenu = new DolphinContextMenu(this, item, url);
- contextMenu->setCustomActions(customActions);
- const DolphinContextMenu::Command command = contextMenu->open();
+ QWeakPointer<DolphinContextMenu> contextMenu = new DolphinContextMenu(this, pos, item, url);
+ contextMenu.data()->setCustomActions(customActions);
+ const DolphinContextMenu::Command command = contextMenu.data()->open();
switch (command) {
case DolphinContextMenu::OpenParentFolderInNewWindow: {
break;
}
- delete contextMenu;
+ delete contextMenu.data();
}
void DolphinMainWindow::updateToolBarMenu()
infoDock->setWidget(infoPanel);
QAction* infoAction = infoDock->toggleViewAction();
- infoAction->setIcon(KIcon("dialog-information"));
- infoAction->setShortcut(Qt::Key_F11);
- addActionCloneToCollection(infoAction, "show_information_panel");
+ createPanelAction(KIcon("dialog-information"), Qt::Key_F11, infoAction, "show_information_panel");
addDockWidget(Qt::RightDockWidgetArea, infoDock);
connect(this, SIGNAL(urlChanged(KUrl)),
foldersDock->setWidget(foldersPanel);
QAction* foldersAction = foldersDock->toggleViewAction();
- foldersAction->setShortcut(Qt::Key_F7);
- foldersAction->setIcon(KIcon("folder"));
- addActionCloneToCollection(foldersAction, "show_folders_panel");
+ createPanelAction(KIcon("folder"), Qt::Key_F7, foldersAction, "show_folders_panel");
addDockWidget(Qt::LeftDockWidgetArea, foldersDock);
connect(this, SIGNAL(urlChanged(KUrl)),
terminalPanel, SLOT(dockVisibilityChanged()));
QAction* terminalAction = terminalDock->toggleViewAction();
- terminalAction->setShortcut(Qt::Key_F4);
- terminalAction->setIcon(KIcon("utilities-terminal"));
- addActionCloneToCollection(terminalAction, "show_terminal_panel");
+ createPanelAction(KIcon("utilities-terminal"), Qt::Key_F4, terminalAction, "show_terminal_panel");
addDockWidget(Qt::BottomDockWidgetArea, terminalDock);
connect(this, SIGNAL(urlChanged(KUrl)),
searchDock->setWidget(searchPanel);
QAction* searchAction = searchDock->toggleViewAction();
- searchAction->setShortcut(Qt::Key_F12);
- searchAction->setIcon(KIcon("system-search"));
- addActionCloneToCollection(searchAction, "show_search_panel");
+ createPanelAction(KIcon("system-search"), Qt::Key_F12, searchAction, "show_search_panel");
addDockWidget(Qt::RightDockWidgetArea, searchDock);
connect(this, SIGNAL(urlChanged(KUrl)),
searchPanel, SLOT(setUrl(KUrl)));
#endif
- const GeneralSettings* generalSettings = DolphinSettings::instance().generalSettings();
- const bool firstRun = generalSettings->firstRun();
- if (firstRun) {
+ if (DolphinSettings::instance().generalSettings()->version() < 200) {
infoDock->hide();
foldersDock->hide();
#ifndef Q_OS_WIN
terminalDock->hide();
#endif
- }
-
#ifdef HAVE_NEPOMUK
- // The search dock has been introduced with Dolphin 1.7.0. Hide it per
- // default when updating from an older Dolphin version or when Dolphin is
- // started the first time.
- if (firstRun || generalSettings->version() < 170) {
searchDock->hide();
- }
#endif
+ }
// Setup "Places"
DolphinDockWidget* placesDock = new DolphinDockWidget(i18nc("@title:window", "Places"));
placesDock->setWidget(placesPanel);
QAction* placesAction = placesDock->toggleViewAction();
- placesAction->setShortcut(Qt::Key_F9);
- placesAction->setIcon(KIcon("bookmarks"));
- addActionCloneToCollection(placesAction, "show_places_panel");
+ createPanelAction(KIcon("bookmarks"), Qt::Key_F9, placesAction, "show_places_panel");
addDockWidget(Qt::LeftDockWidgetArea, placesDock);
connect(placesPanel, SIGNAL(urlChanged(KUrl,Qt::MouseButtons)),
this, SLOT(toggleActiveView()));
connect(view, SIGNAL(tabRequested(KUrl)),
this, SLOT(openNewTab(KUrl)));
- connect(view, SIGNAL(requestContextMenu(KFileItem,KUrl,QList<QAction*>)),
- this, SLOT(openContextMenu(KFileItem,KUrl,QList<QAction*>)));
+ connect(view, SIGNAL(requestContextMenu(QPoint,KFileItem,KUrl,QList<QAction*>)),
+ this, SLOT(openContextMenu(QPoint,KFileItem,KUrl,QList<QAction*>)));
connect(view, SIGNAL(startedPathLoading(KUrl)),
this, SLOT(enableStopAction()));
connect(view, SIGNAL(finishedPathLoading(KUrl)),
return fm.elidedText(text, Qt::ElideMiddle, fm.maxWidth() * 10);
}
-void DolphinMainWindow::addActionCloneToCollection(QAction* action, const QString& actionName)
+void DolphinMainWindow::createPanelAction(const KIcon& icon,
+ const QKeySequence& shortcut,
+ QAction* dockAction,
+ const QString& actionName)
{
- KAction* actionClone = actionCollection()->addAction(actionName);
- actionClone->setText(action->text());
- actionClone->setIcon(action->icon());
- connect(actionClone, SIGNAL(triggered()), action, SLOT(trigger()));
+ KAction* panelAction = actionCollection()->addAction(actionName);
+ panelAction->setText(dockAction->text());
+ panelAction->setIcon(icon);
+ panelAction->setShortcut(shortcut);
+
+ dockAction->setIcon(icon);
+ connect(panelAction, SIGNAL(triggered()), dockAction, SLOT(trigger()));
}
DolphinMainWindow::UndoUiInterface::UndoUiInterface() :