diff options
Diffstat (limited to 'konsole')
-rw-r--r-- | konsole/konsole/TEmulation.cpp | 5 | ||||
-rw-r--r-- | konsole/konsole/TEmulation.h | 1 | ||||
-rw-r--r-- | konsole/konsole/konsole.cpp | 37 | ||||
-rw-r--r-- | konsole/konsole/konsole.h | 7 |
4 files changed, 50 insertions, 0 deletions
diff --git a/konsole/konsole/TEmulation.cpp b/konsole/konsole/TEmulation.cpp index 8dd6da437..39aeab542 100644 --- a/konsole/konsole/TEmulation.cpp +++ b/konsole/konsole/TEmulation.cpp @@ -395,6 +395,11 @@ void TEmulation::copySelection() { TQApplication::clipboard()->setText(t); } +TQString TEmulation::getSelection() { + if (connected) return scr->getSelText(true); + return TQString::null; +} + void TEmulation::streamHistory(TQTextStream* stream) { scr->streamHistory(stream); } diff --git a/konsole/konsole/TEmulation.h b/konsole/konsole/TEmulation.h index 7d3ba65d6..a5f432175 100644 --- a/konsole/konsole/TEmulation.h +++ b/konsole/konsole/TEmulation.h @@ -59,6 +59,7 @@ public slots: // signals incoming from TEWidget virtual void clearSelection(); virtual void copySelection(); + virtual TQString getSelection(); virtual void onSelectionBegin(const int x, const int y, const bool columnmode); virtual void onSelectionExtend(const int x, const int y); virtual void setSelection(const bool preserve_line_breaks); diff --git a/konsole/konsole/konsole.cpp b/konsole/konsole/konsole.cpp index 9c292daa2..e8dacbe5e 100644 --- a/konsole/konsole/konsole.cpp +++ b/konsole/konsole/konsole.cpp @@ -114,6 +114,7 @@ Time to start a requirement list. #include <knotifydialog.h> #include <kprinter.h> #include <kaccelmanager.h> +#include <kurifilter.h> #include <kaction.h> #include <kshell.h> @@ -268,6 +269,7 @@ Konsole::Konsole(const char* name, int histon, bool menubaron, bool tabbaron, bo ,sessionNumberMapper(0) ,sl_sessionShortCuts(0) ,s_workDir(workdir) +,m_filterData(0) { isRestored = b_inRestore; connect( &m_closeTimeout, TQT_SIGNAL(timeout()), this, TQT_SLOT(slotCouldNotClose())); @@ -346,6 +348,8 @@ Konsole::Konsole(const char* name, int histon, bool menubaron, bool tabbaron, bo Konsole::~Konsole() { + delete m_filterData; + sessions.first(); while(sessions.current()) { @@ -718,6 +722,11 @@ void Konsole::makeGUI() m_copyClipboard->plug(m_rightButton); m_pasteClipboard->plug(m_rightButton); + + m_openSelection = new KPopupMenu(this); + m_rightButton->insertItem( i18n("&Open.."), m_openSelection ); + connect(m_openSelection, TQT_SIGNAL(aboutToShow()), TQT_SLOT(slotOpenSelection())); + if (m_signals) m_rightButton->insertItem(i18n("&Send Signal"), m_signals); @@ -3950,6 +3959,34 @@ void Konsole::slotFindHistory() m_finddialog->result(); } +void Konsole::slotOpenSelection() +{ + delete m_filterData; + + m_openSelection->clear(); + disconnect(m_openSelection, TQT_SIGNAL(activated(int)), this, TQT_SLOT(slotOpenURI(int))); + + TQString selection = se->getEmulation()->getSelection(); + TQString curdir = baseURL().path(); + + if ( TQFile::exists( curdir + selection ) ) { + selectedURL = TQString(curdir + selection); + } else { + selectedURL = TQString(selection); + } + + m_filterData = new KURIFilterData( selectedURL ); + KURIFilter::self()->filterURI( *(m_filterData) ); + m_openSelection->insertItem( SmallIconSet( m_filterData->iconName() ),i18n( "%1" ).arg(m_filterData->uri().url()), 1 ); + + connect(m_openSelection, TQT_SIGNAL(activated(int)), TQT_SLOT(slotOpenURI(int))); +} + +void Konsole::slotOpenURI(int) +{ + (void) new KRun( m_filterData->uri() ); +} + void Konsole::slotFindNext() { if( !m_finddialog ) { diff --git a/konsole/konsole/konsole.h b/konsole/konsole/konsole.h index 5b6702412..4ca704a9b 100644 --- a/konsole/konsole/konsole.h +++ b/konsole/konsole/konsole.h @@ -61,6 +61,7 @@ class KSelectAction; class KRadioAction; class KTabWidget; class TQToolButton; +class KURIFilterData; // Defined in main.C const char *konsole_shell(TQStrList &args); @@ -200,6 +201,9 @@ private slots: void loadScreenSessions(); void updateFullScreen(bool on); + void slotOpenSelection(); + void slotOpenURI(int n); + void slotSaveSettings(); void slotSaveSessionsProfile(); void slotConfigureNotifications(); @@ -362,6 +366,7 @@ private: KAction *m_print; KAction *m_quit; KAction *m_tabDetachSession; + KPopupMenu *m_openSelection; KActionCollection *m_shortcuts; @@ -372,6 +377,7 @@ private: bool m_find_first; bool m_find_found; TQString m_find_pattern; + TQString selectedURL; int cmd_serial; int cmd_first_screen; @@ -435,6 +441,7 @@ private: TQString s_workDir; TQColor m_tabColor; + KURIFilterData* m_filterData; }; class TQSpinBox; |