┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/dolphinmainwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/dolphinmainwindow.cpp')
-rw-r--r--src/dolphinmainwindow.cpp45
1 files changed, 28 insertions, 17 deletions
diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp
index 7ae98f896..d4276d492 100644
--- a/src/dolphinmainwindow.cpp
+++ b/src/dolphinmainwindow.cpp
@@ -26,6 +26,7 @@
#include <config-nepomuk.h>
#include "dolphinapplication.h"
+#include "dolphinfileplacesview.h"
#include "dolphinnewmenu.h"
#include "dolphinsettings.h"
#include "dolphinsettingsdialog.h"
@@ -36,11 +37,8 @@
#include "mainwindowadaptor.h"
#include "terminalsidebarpage.h"
#include "treeviewsidebarpage.h"
-#include "kurlnavigator.h"
#include "viewpropertiesdialog.h"
#include "viewproperties.h"
-#include "kfileplacesmodel.h"
-#include "kfileplacesview.h"
#include "dolphin_generalsettings.h"
#include "dolphin_iconsmodesettings.h"
@@ -51,6 +49,7 @@
#include <kdesktopfile.h>
#include <kdeversion.h>
#include <kfiledialog.h>
+#include <kfileplacesmodel.h>
#include <kglobal.h>
#include <kicon.h>
#include <kiconloader.h>
@@ -60,6 +59,7 @@
#include <kmenu.h>
#include <kmenubar.h>
#include <kmessagebox.h>
+#include <kurlnavigator.h>
#include <konqmimedata.h>
#include <kpropertiesdialog.h>
#include <kprotocolinfo.h>
@@ -177,6 +177,13 @@ void DolphinMainWindow::changeSelection(const KFileItemList& selection)
activeViewContainer()->view()->changeSelection(selection);
}
+void DolphinMainWindow::slotEditableStateChanged(bool editable)
+{
+ KToggleAction* editableLocationAction =
+ static_cast<KToggleAction*>(actionCollection()->action("editable_location"));
+ editableLocationAction->setChecked(editable);
+}
+
void DolphinMainWindow::slotSelectionChanged(const KFileItemList& selection)
{
updateEditActions();
@@ -321,7 +328,7 @@ void DolphinMainWindow::slotHandlePlacesError(const QString &message)
void DolphinMainWindow::slotUndoAvailable(bool available)
{
- QAction* undoAction = actionCollection()->action(KStandardAction::stdName(KStandardAction::Undo));
+ QAction* undoAction = actionCollection()->action(KStandardAction::name(KStandardAction::Undo));
if (undoAction != 0) {
undoAction->setEnabled(available);
}
@@ -365,7 +372,7 @@ void DolphinMainWindow::slotUndoAvailable(bool available)
void DolphinMainWindow::slotUndoTextChanged(const QString& text)
{
- QAction* undoAction = actionCollection()->action(KStandardAction::stdName(KStandardAction::Undo));
+ QAction* undoAction = actionCollection()->action(KStandardAction::name(KStandardAction::Undo));
if (undoAction != 0) {
undoAction->setText(text);
}
@@ -394,7 +401,7 @@ void DolphinMainWindow::paste()
void DolphinMainWindow::updatePasteAction()
{
- QAction* pasteAction = actionCollection()->action(KStandardAction::stdName(KStandardAction::Paste));
+ QAction* pasteAction = actionCollection()->action(KStandardAction::name(KStandardAction::Paste));
if (pasteAction == 0) {
return;
}
@@ -599,23 +606,26 @@ void DolphinMainWindow::editSettings()
void DolphinMainWindow::init()
{
+ DolphinSettings& settings = DolphinSettings::instance();
+
// Check whether Dolphin runs the first time. If yes then
// a proper default window size is given at the end of DolphinMainWindow::init().
- GeneralSettings* generalSettings = DolphinSettings::instance().generalSettings();
+ GeneralSettings* generalSettings = settings.generalSettings();
const bool firstRun = generalSettings->firstRun();
if (firstRun) {
generalSettings->setViewPropsTimestamp(QDateTime::currentDateTime());
+ Q_ASSERT(generalSettings->homeUrl().isEmpty());
+ const KUrl homeUrl(QDir::homePath());
+ generalSettings->setHomeUrl(homeUrl.prettyUrl());
}
setAcceptDrops(true);
m_splitter = new QSplitter(this);
- DolphinSettings& settings = DolphinSettings::instance();
-
setupActions();
- const KUrl& homeUrl = settings.generalSettings()->homeUrl();
+ const KUrl& homeUrl = generalSettings->homeUrl();
setCaption(homeUrl.fileName());
m_actionHandler = new DolphinViewActionHandler(actionCollection(), this);
connect(m_actionHandler, SIGNAL(actionBeingHandled()), SLOT(clearStatusBar()));
@@ -713,8 +723,8 @@ void DolphinMainWindow::setupActions()
SLOT(undo()),
actionCollection());
- //Need to remove shift+del from cut action, else the shortcut for deletejob
- //doesn't work
+ // need to remove shift+del from cut action, else the shortcut for deletejob
+ // doesn't work
KAction* cut = KStandardAction::cut(this, SLOT(cut()), actionCollection());
KShortcut cutShortcut = cut->shortcut();
cutShortcut.remove(Qt::SHIFT + Qt::Key_Delete, KShortcut::KeepEmpty);
@@ -751,9 +761,7 @@ void DolphinMainWindow::setupActions()
stop->setIcon(KIcon("process-stop"));
connect(stop, SIGNAL(triggered()), this, SLOT(stopLoading()));
- // TODO: the URL navigator must emit a signal if the editable state has been
- // changed, so that the corresponding showFullLocation action is updated. Also
- // the naming "Show full Location" is currently confusing...
+ // TODO: the naming "Show full Location" is currently confusing...
KToggleAction* showFullLocation = actionCollection()->add<KToggleAction>("editable_location");
showFullLocation->setText(i18nc("@action:inmenu Navigation Bar", "Show Full Location"));
showFullLocation->setShortcut(Qt::CTRL | Qt::Key_L);
@@ -870,7 +878,8 @@ void DolphinMainWindow::setupDockWidgets()
QDockWidget* placesDock = new QDockWidget(i18nc("@title:window", "Places"));
placesDock->setObjectName("placesDock");
placesDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
- KFilePlacesView* placesView = new KFilePlacesView(placesDock);
+
+ DolphinFilePlacesView* placesView = new DolphinFilePlacesView(placesDock);
placesDock->setWidget(placesView);
placesView->setModel(DolphinSettings::instance().placesModel());
placesView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
@@ -950,7 +959,7 @@ void DolphinMainWindow::updateViewActions()
void DolphinMainWindow::updateGoActions()
{
- QAction* goUpAction = actionCollection()->action(KStandardAction::stdName(KStandardAction::Up));
+ QAction* goUpAction = actionCollection()->action(KStandardAction::name(KStandardAction::Up));
const KUrl& currentUrl = m_activeViewContainer->url();
goUpAction->setEnabled(currentUrl.upUrl() != currentUrl);
}
@@ -981,6 +990,8 @@ void DolphinMainWindow::connectViewSignals(int viewIndex)
this, SLOT(changeUrl(const KUrl&)));
connect(navigator, SIGNAL(historyChanged()),
this, SLOT(slotHistoryChanged()));
+ connect(navigator, SIGNAL(editableStateChanged(bool)),
+ this, SLOT(slotEditableStateChanged(bool)));
}
void DolphinMainWindow::updateSplitAction()