-}
-
-void DolphinMainWindow::setupCreateNewMenuActions()
-{
- // Parts of the following code have been taken
- // from the class KNewMenu located in
- // libqonq/knewmenu.h of Konqueror.
- // Copyright (C) 1998, 1999 David Faure <faure@kde.org>
- // 2003 Sven Leiber <s.leiber@web.de>
-
- QStringList files = actionCollection()->instance()->dirs()->findAllResources("templates");
- for (QStringList::Iterator it = files.begin() ; it != files.end(); ++it) {
- if ((*it)[0] != '.' ) {
- KSimpleConfig config(*it, true);
- config.setDesktopGroup();
-
- // tricky solution to ensure that TextFile is at the beginning
- // because this filetype is the most used (according kde-core discussion)
- const QString name(config.readEntry("Name"));
- QString key(name);
-
- const QString path(config.readPathEntry("Url"));
- if (!path.endsWith("emptydir")) {
- if (path.endsWith("TextFile.txt")) {
- key = "1" + key;
- }
- else if (!KDesktopFile::isDesktopFile(path)) {
- key = "2" + key;
- }
- else if (path.endsWith("Url.desktop")){
- key = "3" + key;
- }
- else if (path.endsWith("Program.desktop")){
- key = "4" + key;
- }
- else {
- key = "5";
- }
-
- const QString icon(config.readEntry("Icon"));
- const QString comment(config.readEntry("Comment"));
- const QString type(config.readEntry("Type"));
-
- const QString filePath(*it);
-
-
- if (type == "Link") {
- CreateFileEntry entry;
- entry.name = name;
- entry.icon = icon;
- entry.comment = comment;
- entry.templatePath = filePath;
- m_createFileTemplates.insert(key, entry);
- }
- }
- }
- }
- m_createFileTemplates.sort();
-
- unplugActionList("create_actions");
- KSortableList<CreateFileEntry, QString>::ConstIterator it = m_createFileTemplates.begin();
- KSortableList<CreateFileEntry, QString>::ConstIterator end = m_createFileTemplates.end();
- /* KDE4-TODO: don't port this code; use KNewMenu instead
- while (it != end) {
- CreateFileEntry entry = (*it).value();
- KAction* action = new KAction(entry.name);
- action->setIcon(entry.icon);
- action->setName((*it).index());
- connect(action, SIGNAL(activated()),
- this, SLOT(createFile()));
-
- const QChar section = ((*it).index()[0]);
- switch (section) {
- case '1':
- case '2': {
- m_fileGroupActions.append(action);
- break;
- }
-
- case '3':
- case '4': {
- // TODO: not used yet. See documentation of DolphinMainWindow::linkGroupActions()
- // and DolphinMainWindow::linkToDeviceActions() in the header file for details.
- //m_linkGroupActions.append(action);
- break;
- }
-
- case '5': {
- // TODO: not used yet. See documentation of DolphinMainWindow::linkGroupActions()
- // and DolphinMainWindow::linkToDeviceActions() in the header file for details.
- //m_linkToDeviceActions.append(action);
- break;
- }
- default:
- break;
- }
- ++it;
+ connect(this, SIGNAL(urlChanged(KUrl)),
+ infoPanel, SLOT(setUrl(KUrl)));
+ connect(this, SIGNAL(selectionChanged(KFileItemList)),
+ infoPanel, SLOT(setSelection(KFileItemList)));
+ connect(this, SIGNAL(requestItemInfo(KFileItem)),
+ infoPanel, SLOT(requestDelayedItemInfo(KFileItem)));
+
+ // setup "Folders"
+ QDockWidget* foldersDock = new QDockWidget(i18nc("@title:window", "Folders"));
+ foldersDock->setObjectName("foldersDock");
+ foldersDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
+ FoldersPanel* foldersPanel = new FoldersPanel(foldersDock);
+ foldersDock->setWidget(foldersPanel);
+
+ QAction* foldersAction = foldersDock->toggleViewAction();
+ foldersAction->setText(i18nc("@title:window", "Folders"));
+ foldersAction->setShortcut(Qt::Key_F7);
+ foldersAction->setIcon(KIcon("folder"));
+ actionCollection()->addAction("show_folders_panel", foldersDock->toggleViewAction());
+
+ addDockWidget(Qt::LeftDockWidgetArea, foldersDock);
+ connect(this, SIGNAL(urlChanged(KUrl)),
+ foldersPanel, SLOT(setUrl(KUrl)));
+ connect(foldersPanel, SIGNAL(changeUrl(KUrl, Qt::MouseButtons)),
+ this, SLOT(handlePlacesClick(KUrl, Qt::MouseButtons)));
+ connect(foldersPanel, SIGNAL(changeSelection(KFileItemList)),
+ this, SLOT(changeSelection(KFileItemList)));
+
+ // setup "Terminal"
+#ifndef Q_OS_WIN
+ QDockWidget* terminalDock = new QDockWidget(i18nc("@title:window Shell terminal", "Terminal"));
+ terminalDock->setObjectName("terminalDock");
+ terminalDock->setAllowedAreas(Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea);
+ Panel* terminalPanel = new TerminalPanel(terminalDock);
+ terminalDock->setWidget(terminalPanel);
+
+ connect(terminalPanel, SIGNAL(hideTerminalPanel()), terminalDock, SLOT(hide()));
+
+ QAction* terminalAction = terminalDock->toggleViewAction();
+ terminalAction->setText(i18nc("@title:window Shell terminal", "Terminal"));
+ terminalAction->setShortcut(Qt::Key_F4);
+ terminalAction->setIcon(KIcon("terminal"));
+ actionCollection()->addAction("show_terminal_panel", terminalDock->toggleViewAction());
+
+ addDockWidget(Qt::BottomDockWidgetArea, terminalDock);
+ connect(this, SIGNAL(urlChanged(KUrl)),
+ terminalPanel, SLOT(setUrl(KUrl)));
+#endif
+
+ const bool firstRun = DolphinSettings::instance().generalSettings()->firstRun();
+ if (firstRun) {
+ foldersDock->hide();
+#ifndef Q_OS_WIN
+ terminalDock->hide();
+#endif