#include <config-nepomuk.h>
#include "dolphinapplication.h"
+#include "dolphinfileplacesview.h"
#include "dolphinnewmenu.h"
#include "dolphinsettings.h"
#include "dolphinsettingsdialog.h"
#include "infosidebarpage.h"
#include "metadatawidget.h"
#include "mainwindowadaptor.h"
-#include "terminalsidebarpage.h"
#include "treeviewsidebarpage.h"
-#include "kurlnavigator.h"
#include "viewpropertiesdialog.h"
#include "viewproperties.h"
-#include "kfileplacesmodel.h"
-#include "kfileplacesview.h"
+
+#ifndef Q_OS_WIN
+#include "terminalsidebarpage.h"
+#endif
#include "dolphin_generalsettings.h"
#include "dolphin_iconsmodesettings.h"
#include <kdesktopfile.h>
#include <kdeversion.h>
#include <kfiledialog.h>
+#include <kfileplacesmodel.h>
#include <kglobal.h>
#include <kicon.h>
#include <kiconloader.h>
#include <kmenu.h>
#include <kmenubar.h>
#include <kmessagebox.h>
+#include <kurlnavigator.h>
#include <konqmimedata.h>
#include <kpropertiesdialog.h>
#include <kprotocolinfo.h>
m_showMenuBar(0),
m_splitter(0),
m_activeViewContainer(0),
- m_id(id)
+ m_id(id),
+ m_viewContainer(),
+ m_actionHandler(0)
{
- setObjectName("Dolphin");
+ setObjectName("Dolphin#");
m_viewContainer[PrimaryView] = 0;
m_viewContainer[SecondaryView] = 0;
dropController.dropUrls(urls, destination);
}
+void DolphinMainWindow::pasteIntoFolder()
+{
+ m_activeViewContainer->view()->pasteIntoFolder();
+}
+
void DolphinMainWindow::changeUrl(const KUrl& url)
{
DolphinViewContainer* view = activeViewContainer();
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();
emit requestItemInfo(item);
}
-void DolphinMainWindow::slotHistoryChanged()
+void DolphinMainWindow::updateHistory()
{
- updateHistory();
+ const KUrlNavigator* urlNavigator = m_activeViewContainer->urlNavigator();
+ const int index = urlNavigator->historyIndex();
+
+ QAction* backAction = actionCollection()->action("go_back");
+ if (backAction != 0) {
+ backAction->setEnabled(index < urlNavigator->historySize() - 1);
+ }
+
+ QAction* forwardAction = actionCollection()->action("go_forward");
+ if (forwardAction != 0) {
+ forwardAction->setEnabled(index > 0);
+ }
}
void DolphinMainWindow::updateFilterBarAction(bool show)
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);
}
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);
}
void DolphinMainWindow::updatePasteAction()
{
- QAction* pasteAction = actionCollection()->action(KStandardAction::stdName(KStandardAction::Paste));
+ QAction* pasteAction = actionCollection()->action(KStandardAction::name(KStandardAction::Paste));
if (pasteAction == 0) {
return;
}
setActiveViewContainer(m_viewContainer[PrimaryView]);
updateViewActions();
- emit activeViewChanged(); // TODO unused; remove?
}
void DolphinMainWindow::reloadView()
KUrlNavigator* navigator = m_activeViewContainer->urlNavigator();
navigator->setUrlEditable(true);
navigator->setFocus();
+
+ // select the whole text of the combo box editor
+ QLineEdit* lineEdit = navigator->editor()->lineEdit();
+ const QString text = lineEdit->text();
+ lineEdit->setSelection(0, text.length());
}
void DolphinMainWindow::adjustViewProperties()
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());
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()));
if (firstRun) {
// assure a proper default size if Dolphin runs the first time
- resize(700, 500);
+ resize(750, 500);
}
emit urlChanged(homeUrl);
m_activeViewContainer = viewContainer;
m_activeViewContainer->setActive(true);
+ m_actionHandler->setCurrentView(viewContainer->view());
+
updateHistory();
updateEditActions();
updateViewActions();
const KUrl& url = m_activeViewContainer->url();
setCaption(url.fileName());
- m_actionHandler->setCurrentView(viewContainer->view());
-
- emit activeViewChanged(); // TODO unused; remove?
emit urlChanged(url);
}
// setup 'File' menu
m_newMenu = new DolphinNewMenu(this);
KMenu* menu = m_newMenu->menu();
- menu->setTitle(i18nc("@title:menu", "Create New"));
+ menu->setTitle(i18nc("@title:menu Create new folder, file, link, etc.", "Create New"));
menu->setIcon(KIcon("document-new"));
connect(menu, SIGNAL(aboutToShow()),
this, SLOT(updateNewMenu()));
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);
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);
this, SLOT(dropUrls(KUrl::List, KUrl)));
// setup "Terminal"
- QDockWidget* terminalDock = new QDockWidget(i18nc("@title:window", "Terminal"));
+#ifndef Q_OS_WIN
+ QDockWidget* terminalDock = new QDockWidget(i18nc("@title:window Shell terminal", "Terminal"));
terminalDock->setObjectName("terminalDock");
terminalDock->setAllowedAreas(Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea);
SidebarPage* terminalWidget = new TerminalSidebarPage(terminalDock);
connect(terminalWidget, SIGNAL(hideTerminalSidebarPage()), terminalDock, SLOT(hide()));
- terminalDock->toggleViewAction()->setText(i18nc("@title:window", "Terminal"));
+ terminalDock->toggleViewAction()->setText(i18nc("@title:window Shell terminal", "Terminal"));
terminalDock->toggleViewAction()->setShortcut(Qt::Key_F4);
actionCollection()->addAction("show_terminal_panel", terminalDock->toggleViewAction());
addDockWidget(Qt::BottomDockWidgetArea, terminalDock);
connect(this, SIGNAL(urlChanged(KUrl)),
terminalWidget, SLOT(setUrl(KUrl)));
+#endif
const bool firstRun = DolphinSettings::instance().generalSettings()->firstRun();
if (firstRun) {
- infoDock->hide();
treeViewDock->hide();
+#ifndef Q_OS_WIN
terminalDock->hide();
+#endif
}
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);
placesView, SLOT(setUrl(KUrl)));
}
-void DolphinMainWindow::updateHistory()
-{
- const KUrlNavigator* urlNavigator = m_activeViewContainer->urlNavigator();
- const int index = urlNavigator->historyIndex();
-
- QAction* backAction = actionCollection()->action("go_back");
- if (backAction != 0) {
- backAction->setEnabled(index < urlNavigator->historySize() - 1);
- }
-
- QAction* forwardAction = actionCollection()->action("go_forward");
- if (forwardAction != 0) {
- forwardAction->setEnabled(index > 0);
- }
-}
-
void DolphinMainWindow::updateEditActions()
{
const KFileItemList list = m_activeViewContainer->view()->selectedItems();
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);
}
connect(navigator, SIGNAL(urlChanged(const KUrl&)),
this, SLOT(changeUrl(const KUrl&)));
connect(navigator, SIGNAL(historyChanged()),
- this, SLOT(slotHistoryChanged()));
+ this, SLOT(updateHistory()));
+ connect(navigator, SIGNAL(editableStateChanged(bool)),
+ this, SLOT(slotEditableStateChanged(bool)));
}
void DolphinMainWindow::updateSplitAction()