#include <kurl.h>
#include <kurlcombobox.h>
+#include <QDBusMessage>
#include <QKeyEvent>
#include <QClipboard>
#include <QLineEdit>
viewTab.primaryView->view()->reload();
m_viewTab.append(viewTab);
+
+ actionCollection()->action("close_tab")->setEnabled(true);
}
void DolphinMainWindow::toggleActiveView()
const KUrl::List urls = activeViewContainer()->view()->selectedUrls();
Q_ASSERT(urls.count() > 0);
- // TODO: this is a quick hack - use QDBus interface directly in future
- const QString command = "qdbus org.kde.plasma /Previewer org.kde.Previewer.openFile";
+ QDBusMessage msg = QDBusMessage::createMethodCall("org.kde.plasma", "/Previewer", "", "openFile");
foreach (const KUrl& url, urls) {
- QString openUrlCommand = command;
- openUrlCommand.append(" \"");
- openUrlCommand.append(url.prettyUrl());
- openUrlCommand.append('"');
- KRun::runCommand(openUrlCommand, 0, 0, this);
+ msg.setArguments(QList<QVariant>() << url.prettyUrl());
+ QDBusConnection::sessionBus().send(msg);
}
}
if (index == m_tabIndex) {
// The tab that should be closed is the active tab. Activate the
// previous tab before closing the tab.
- setActiveTab((index > 0) ? index - 1 : 1);
+ m_tabBar->setCurrentIndex((index > 0) ? index - 1 : 1);
}
// delete tab
// closing the last tab is not possible
if (m_viewTab.count() == 1) {
m_tabBar->removeTab(0);
+ actionCollection()->action("close_tab")->setEnabled(false);
} else {
m_tabBar->blockSignals(false);
}
}
}
+void DolphinMainWindow::slotTestCanDecode(const QDragMoveEvent* event, bool& canDecode)
+{
+ canDecode = KUrl::List::canDecode(event->mimeData());
+}
+
void DolphinMainWindow::init()
{
DolphinSettings& settings = DolphinSettings::instance();
this, SLOT(openTabContextMenu(int, const QPoint&)));
connect(m_tabBar, SIGNAL(newTabRequest()),
this, SLOT(openNewTab()));
+ connect(m_tabBar, SIGNAL(testCanDecode(const QDragMoveEvent*, bool&)),
+ this, SLOT(slotTestCanDecode(const QDragMoveEvent*, bool&)));
m_tabBar->blockSignals(true); // signals get unblocked after at least 2 tabs are open
QWidget* centralWidget = new QWidget(this);
setupDockWidgets();
setupGUI(Keys | Save | Create | ToolBar);
- createGUI();
stateChanged("new_file");
- setAutoSaveSettings();
QClipboard* clipboard = QApplication::clipboard();
connect(clipboard, SIGNAL(dataChanged()),
}
updateViewActions();
+ QAction* showFilterBarAction = actionCollection()->action("show_filter_bar");
+ showFilterBarAction->setChecked(generalSettings->filterBar());
+
if (firstRun) {
// assure a proper default size if Dolphin runs the first time
resize(750, 500);
QAction* closeTab = new QAction(KIcon("tab-close"), i18nc("@action:inmenu File", "Close Tab"), this);
closeTab->setShortcut(Qt::CTRL | Qt::Key_W);
+ closeTab->setEnabled(false);
connect(closeTab, SIGNAL(triggered()), this, SLOT(closeTab()));
actionCollection()->addAction("close_tab", closeTab);
KAction* quickView = actionCollection()->addAction("quick_view");
quickView->setText(i18nc("@action:inmenu Tools", "Quick View"));
quickView->setIcon(KIcon("view-preview"));
- quickView->setShortcut(Qt::Key_Space);
+ quickView->setShortcut(Qt::CTRL + Qt::Key_Return);
quickView->setEnabled(false);
connect(quickView, SIGNAL(triggered()), this, SLOT(quickView()));