summaryrefslogtreecommitdiffstats
path: root/kate
diff options
context:
space:
mode:
authorMavridis Philippe <mavridisf@gmail.com>2024-05-25 22:10:49 +0300
committerMavridis Philippe <mavridisf@gmail.com>2024-06-02 15:30:52 +0300
commita9d34c14366e18066f67b972eab79a03d1081726 (patch)
tree75be1cfe258d6f1f9e64a44324e7d921c5008b08 /kate
parente8d015be37f007cfc56d74eef8b192d19e96a61b (diff)
downloadtdebase-a9d34c14366e18066f67b972eab79a03d1081726.tar.gz
tdebase-a9d34c14366e18066f67b972eab79a03d1081726.zip
Kate: use mouse back/forward buttons to move between open documents
The direction of movement can be configured (reversed) through the settings dialog. Signed-off-by: Mavridis Philippe <mavridisf@gmail.com>
Diffstat (limited to 'kate')
-rw-r--r--kate/app/katefilelist.cpp1
-rw-r--r--kate/app/katemainwindow.cpp37
-rw-r--r--kate/app/katemainwindow.h13
3 files changed, 37 insertions, 14 deletions
diff --git a/kate/app/katefilelist.cpp b/kate/app/katefilelist.cpp
index b33d0149b..f8371585e 100644
--- a/kate/app/katefilelist.cpp
+++ b/kate/app/katefilelist.cpp
@@ -176,6 +176,7 @@ void KateFileList::keyPressEvent(TQKeyEvent *e) {
// returning
void KateFileList::contentsMousePressEvent( TQMouseEvent *e )
{
+ if (e->button() != TQMouseEvent::LeftButton) return;
m_lastMouseDownPos = e->pos();
if ( ! itemAt( contentsToViewport( e->pos() ) ) )
diff --git a/kate/app/katemainwindow.cpp b/kate/app/katemainwindow.cpp
index 811145182..d432d49d4 100644
--- a/kate/app/katemainwindow.cpp
+++ b/kate/app/katemainwindow.cpp
@@ -151,6 +151,8 @@ KateMainWindow::KateMainWindow (TDEConfig *sconfig, const TQString &sgroup)
m_dcop = new KateMainWindowDCOPIface (this);
+ m_mainWindow->installEventFilter(this);
+
// setup the most important widgets
setupMainWindow();
@@ -213,6 +215,7 @@ void KateMainWindow::setupMainWindow ()
KateMDI::ToolView *ft = createToolView("kate_filelist", KMultiTabBar::Left, SmallIcon("application-vnd.tde.tdemultiple"), i18n("Documents"));
filelist = new KateFileList (this, m_viewManager, ft, "filelist");
filelist->readConfig(KateApp::self()->config(), "Filelist");
+ filelist->viewport()->installEventFilter(this);
KateMDI::ToolView *t = createToolView("kate_fileselector", KMultiTabBar::Left, SmallIcon("document-open"), i18n("Filesystem Browser"));
fileselector = new KateFileSelector( this, m_viewManager, t, "operator");
@@ -306,11 +309,11 @@ void KateMainWindow::setupActions()
slotWindowActivated ();
// session actions
- new TDEAction(i18n("&New"), "list-add", 0,
+ new TDEAction(i18n("&New"), "list-add", 0,
m_sessionpanel, TQ_SLOT(slotNewSession()), actionCollection(), "session_new");
- new TDEAction(i18n("&Save"), "document-save", 0,
+ new TDEAction(i18n("&Save"), "document-save", 0,
m_sessionpanel, TQ_SLOT(slotSaveSession()), actionCollection(), "session_save");
- new TDEAction(i18n("Save &As..."), "document-save-as", 0,
+ new TDEAction(i18n("Save &As..."), "document-save-as", 0,
m_sessionpanel, TQ_SLOT(slotSaveSessionAs()), actionCollection(), "session_save_as");
new TDEAction(i18n("&Rename"), "edit_user", 0,
m_sessionpanel, TQ_SLOT(slotRenameSession()), actionCollection(), "session_rename");
@@ -423,7 +426,7 @@ void KateMainWindow::slotNewToolbarConfig()
void KateMainWindow::slotFileQuit()
{
- KateApp::self()->shutdownKate(this);
+ KateApp::self()->shutdownKate(this);
}
void KateMainWindow::readOptions ()
@@ -596,7 +599,7 @@ void KateMainWindow::slotConfigure()
dlg->exec();
delete dlg;
-
+
// Inform Kate that options may have been changed
KateApp::self()->reparse_config();
}
@@ -888,6 +891,24 @@ void KateMainWindow::readProperties(TDEConfig *config)
config->setGroup(grp);
}
+bool KateMainWindow::eventFilter(TQObject *obj, TQEvent *ev)
+{
+ if (ev->type() == TQEvent::MouseButtonRelease)
+ {
+ TQMouseEvent *mouseEvent = static_cast<TQMouseEvent *>(ev);
+ switch (mouseEvent->button())
+ {
+ case TQMouseEvent::HistoryBackButton:
+ filelist->slotPrevDocument();
+ return true;
+ case TQMouseEvent::HistoryForwardButton:
+ filelist->slotNextDocument();
+ return true;
+ }
+ }
+ return false;
+}
+
//-------------------------------------------
void KateMainWindow::slotSelectionChanged()
{
@@ -905,8 +926,8 @@ void KateMainWindow::slotSelectionChanged()
if (a)
{
a->setEnabled((*spa_it)->isEnabled());
- }
- }
+ }
+ }
}
//-------------------------------------------
@@ -916,7 +937,7 @@ void KateMainWindow::activateSession(int sessionId)
{
return;
}
-
+
// Select the required session in the session panel's listview
TQListViewItem *item = m_sessionpanel->m_listview->firstChild();
int idx = 0;
diff --git a/kate/app/katemainwindow.h b/kate/app/katemainwindow.h
index 1e8839991..8901be978 100644
--- a/kate/app/katemainwindow.h
+++ b/kate/app/katemainwindow.h
@@ -105,16 +105,16 @@ class KateMainWindow : public KateMDI::MainWindow, virtual public KParts::PartBa
bool queryClose_internal();
void openURL (const TQString &name=0L);
-
+
public slots:
/**
* update "Sessions" menu status when selection in session panel has changed
*/
void slotSelectionChanged();
-
+
/**
* activate the specified session. When there is the need to activate a session
- * from the outside (for example from DCOP), using this method assures that
+ * from the outside (for example from DCOP), using this method assures that
* the session activation is consistent with the behavior of the session panel
* @param sessionId the id of the session to activate
*/
@@ -176,9 +176,10 @@ class KateMainWindow : public KateMDI::MainWindow, virtual public KParts::PartBa
void updateGrepDir (bool visible);
void slotDocumentCloseAll();
-
+
protected:
bool event( TQEvent * );
+ bool eventFilter(TQObject *obj, TQEvent *ev);
private:
static uint uniqueID;
@@ -215,7 +216,7 @@ class KateMainWindow : public KateMDI::MainWindow, virtual public KParts::PartBa
KateExternalToolsMenuAction *externalTools;
GrepTool * greptool;
- bool m_modignore, m_grrr;
+ bool m_modignore;
KateTabWidget *m_tabWidget;
};
@@ -230,7 +231,7 @@ class KateSessionListActionMenu : public TDEActionMenu
public slots:
void slotAboutToShow();
-
+
protected:
KateMainWindow *m_mainWindow;
};