┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2008-05-07 20:02:37 +0000
committerPeter Penz <[email protected]>2008-05-07 20:02:37 +0000
commitd4287eb8e36ead543eb595bfcaa217fa0edd2654 (patch)
tree63e8c87ed42e060b86df27d06c69f0f1f5c5ca2c
parent9f60cbdb63d19b8698fea36c71b340bcf6c0930b (diff)
allow Konqueror to open also files inside a new tab, not only directories
CCMAIL: [email protected] svn path=/trunk/KDE/kdebase/apps/; revision=805184
-rw-r--r--src/dolphincontroller.cpp2
-rw-r--r--src/dolphinpart.cpp2
-rw-r--r--src/dolphinview.cpp11
-rw-r--r--src/dolphinview.h21
4 files changed, 29 insertions, 7 deletions
diff --git a/src/dolphincontroller.cpp b/src/dolphincontroller.cpp
index 7dd6133f0..57d4a76fb 100644
--- a/src/dolphincontroller.cpp
+++ b/src/dolphincontroller.cpp
@@ -150,7 +150,7 @@ void DolphinController::triggerItem(const QModelIndex& index)
const KFileItem item = itemForIndex(index);
if (index.isValid() && (index.column() == KDirModel::Name)) {
- if (openTab && item.isDir()) {
+ if (openTab && (item.isDir() || m_dolphinView->isTabsForFilesEnabled())) {
emit tabRequested(item.url());
} else {
emit itemTriggered(item);
diff --git a/src/dolphinpart.cpp b/src/dolphinpart.cpp
index 4f378fe6d..296e101d6 100644
--- a/src/dolphinpart.cpp
+++ b/src/dolphinpart.cpp
@@ -77,6 +77,7 @@ DolphinPart::DolphinPart(QWidget* parentWidget, QObject* parent, const QVariantL
m_dirLister,
m_dolphinModel,
m_proxyModel);
+ m_view->setTabsForFilesEnabled(true);
setWidget(m_view);
setXMLFile("dolphinpart.rc");
@@ -284,7 +285,6 @@ void DolphinPart::createNewWindow(const KUrl& url)
// TODO: Check issue N176832 for the missing QAIV signal; task 177399 - maybe this code
// should be moved into DolphinPart::slotItemTriggered()
KFileItem item(S_IFDIR, (mode_t)-1, url);
- Q_ASSERT(item.mimeTypePtr()->is("inode/directory")); // the signal 'tabRequested' is only emitted for dirs
KParts::OpenUrlArguments args;
args.setMimeType(item.mimetype());
emit m_extension->createNewWindow(url, args);
diff --git a/src/dolphinview.cpp b/src/dolphinview.cpp
index 5dd81426f..5a0f00bee 100644
--- a/src/dolphinview.cpp
+++ b/src/dolphinview.cpp
@@ -70,6 +70,7 @@ DolphinView::DolphinView(QWidget* parent,
m_showPreview(false),
m_loadingDirectory(false),
m_storedCategorizedSorting(false),
+ m_tabsForFiles(false),
m_isContextMenuOpen(false),
m_mode(DolphinView::IconsView),
m_topLayout(0),
@@ -913,6 +914,16 @@ QPair<bool, QString> DolphinView::pasteInfo() const
return ret;
}
+void DolphinView::setTabsForFilesEnabled(bool tabsForFiles)
+{
+ m_tabsForFiles = tabsForFiles;
+}
+
+bool DolphinView::isTabsForFilesEnabled() const
+{
+ return m_tabsForFiles;
+}
+
void DolphinView::emitContentsMoved()
{
// only emit the contents moved signal if:
diff --git a/src/dolphinview.h b/src/dolphinview.h
index 1fcdaa087..9af9aab8d 100644
--- a/src/dolphinview.h
+++ b/src/dolphinview.h
@@ -316,6 +316,15 @@ public:
*/
QPair<bool, QString> pasteInfo() const;
+ /**
+ * If \a tabsForFiles is true, the signal tabRequested() will also
+ * emitted also for files. Per default tabs for files is disabled
+ * and hence the signal tabRequested() will only be emitted for
+ * directories.
+ */
+ void setTabsForFilesEnabled(bool tabsForFiles);
+ bool isTabsForFilesEnabled() const;
+
public slots:
/**
* Changes the directory to \a url. If the current directory is equal to
@@ -641,11 +650,13 @@ private:
}
private:
- bool m_active;
- bool m_showPreview;
- bool m_loadingDirectory;
- bool m_storedCategorizedSorting;
- bool m_isContextMenuOpen; // TODO: workaround for Qt-issue xxxxxx
+ bool m_active : 1;
+ bool m_showPreview : 1;
+ bool m_loadingDirectory : 1;
+ bool m_storedCategorizedSorting : 1;
+ bool m_tabsForFiles : 1;
+ bool m_isContextMenuOpen : 1; // TODO: workaround for Qt-issue xxxxxx
+
Mode m_mode;
DolphinMainWindow* m_mainWindow;