X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/175fe7ff47ccff39b0e77f80491a9701d025375e..abf17941f7a052d25788d2f2f3c84e5aae935e29:/src/dolphinmainwindow.cpp diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index e8071ac44..a25c61038 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -36,6 +36,7 @@ #include "generalsettings.h" #include "viewpropertiesdialog.h" #include "viewproperties.h" +#include "mainwindowadaptor.h" #include #include @@ -70,16 +71,20 @@ #include #include -DolphinMainWindow::DolphinMainWindow() : +DolphinMainWindow::DolphinMainWindow(int id) : KMainWindow(0), m_newMenu(0), m_splitter(0), - m_activeView(0) + m_activeView(0), + m_id(id) { setObjectName("Dolphin"); m_view[PrimaryIdx] = 0; m_view[SecondaryIdx] = 0; + new MainWindowAdaptor(this); + QDBusConnection::sessionBus().registerObject(QString("/dolphin/MainWindow%1").arg(m_id), this); + KonqUndoManager::incRef(); KonqUndoManager* undoManager = KonqUndoManager::self(); @@ -161,7 +166,7 @@ void DolphinMainWindow::dropUrls(const KUrl::List& urls, i18n("&Link Here") + "\t" + seq); popup.addSeparator(); - QAction* cancelAction = popup.addAction(KIcon("stop"), i18n("Cancel")); + popup.addAction(KIcon("stop"), i18n("Cancel")); QAction* activatedAction = popup.exec(QCursor::pos()); if (activatedAction == moveAction) { @@ -173,7 +178,7 @@ void DolphinMainWindow::dropUrls(const KUrl::List& urls, else if (activatedAction == linkAction) { action = Qt::LinkAction; } - else if (activatedAction == cancelAction) { + else { return; } } @@ -231,6 +236,13 @@ void DolphinMainWindow::refreshViews() emit activeViewChanged(); } +void DolphinMainWindow::changeUrl(const QString& url) +{ + if (activeView() != 0) { + activeView()->setUrl(KUrl(url)); + } +} + void DolphinMainWindow::slotViewModeChanged() { updateViewActions(); @@ -767,8 +779,6 @@ void DolphinMainWindow::toggleEditLocation() void DolphinMainWindow::editLocation() { - KToggleAction* action = static_cast(actionCollection()->action("editable_location")); - action->setChecked(true); m_activeView->setUrlEditable(true); } @@ -885,6 +895,9 @@ void DolphinMainWindow::init() // a proper default window size is given at the end of DolphinMainWindow::init(). GeneralSettings* generalSettings = DolphinSettings::instance().generalSettings(); const bool firstRun = generalSettings->firstRun(); + if (firstRun) { + generalSettings->setViewPropsTimestamp(QDateTime::currentDateTime()); + } setAcceptDrops(true); @@ -998,8 +1011,8 @@ void DolphinMainWindow::setupActions() connect(deleteAction, SIGNAL(triggered()), this, SLOT(deleteItems())); QAction* properties = actionCollection()->addAction("properties"); - properties->setText(i18n("Propert&ies")); - properties->setShortcut(Qt::Key_Alt | Qt::Key_Return); + properties->setText(i18n("Properties")); + properties->setShortcut(Qt::ALT | Qt::Key_Return); connect(properties, SIGNAL(triggered()), this, SLOT(properties())); KStandardAction::quit(this, SLOT(quit()), actionCollection()); @@ -1090,7 +1103,7 @@ void DolphinMainWindow::setupActions() KToggleAction* showHiddenFiles = actionCollection()->add("show_hidden_files"); showHiddenFiles->setText(i18n("Show Hidden Files")); - //showHiddenFiles->setShortcut(Qt::ALT | Qt::Key_ KDE4-TODO: what Qt-Key represents '.'? + showHiddenFiles->setShortcut(Qt::ALT | Qt::Key_Period); connect(showHiddenFiles, SIGNAL(triggered()), this, SLOT(toggleShowHiddenFiles())); KToggleAction* split = actionCollection()->add("split_view"); @@ -1110,12 +1123,15 @@ void DolphinMainWindow::setupActions() stop->setIcon(KIcon("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... KToggleAction* showFullLocation = actionCollection()->add("editable_location"); showFullLocation->setText(i18n("Show Full Location")); showFullLocation->setShortcut(Qt::CTRL | Qt::Key_L); connect(showFullLocation, SIGNAL(triggered()), this, SLOT(toggleEditLocation())); - KToggleAction* editLocation = actionCollection()->add("edit_location"); + QAction* editLocation = actionCollection()->addAction("edit_location"); editLocation->setText(i18n("Edit Location")); editLocation->setShortcut(Qt::Key_F6); connect(editLocation, SIGNAL(triggered()), this, SLOT(editLocation())); @@ -1273,6 +1289,10 @@ void DolphinMainWindow::updateViewActions() KToggleAction* splitAction = static_cast(actionCollection()->action("split_view")); splitAction->setChecked(m_view[SecondaryIdx] != 0); + + KToggleAction* editableLocactionAction = + static_cast(actionCollection()->action("editable_location")); + editableLocactionAction->setChecked(m_activeView->isUrlEditable()); } void DolphinMainWindow::updateGoActions()