diff options
author | Michele Calgaro <michele.calgaro@yahoo.it> | 2025-08-28 22:44:34 +0900 |
---|---|---|
committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2025-08-31 23:30:34 +0900 |
commit | f9abd9d505434c9244c03eac708e29a0ca042f6b (patch) | |
tree | 30a197ab4c413849188bc131ff859212e636c821 /src/app/GUI/dirhistorybutton.cpp | |
parent | 14d42d284de233f9937becf3fc9ee0dabede3b21 (diff) | |
download | krusader-r14.1.x.tar.gz krusader-r14.1.x.zip |
Restructure source foldersr14.1.x
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
(cherry picked from commit 086012dcad8a976a0dabbb7cbc20c9cb612cdfa9)
Diffstat (limited to 'src/app/GUI/dirhistorybutton.cpp')
-rw-r--r-- | src/app/GUI/dirhistorybutton.cpp | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/src/app/GUI/dirhistorybutton.cpp b/src/app/GUI/dirhistorybutton.cpp new file mode 100644 index 0000000..a311b0a --- /dev/null +++ b/src/app/GUI/dirhistorybutton.cpp @@ -0,0 +1,82 @@ +/*************************************************************************** + dirhistorybutton.cpp - description + ------------------- + begin : Sun Jan 4 2004 + copyright : (C) 2004 by Shie Erlich & Rafi Yanai + email : +***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "dirhistorybutton.h" +#include "dirhistoryqueue.h" + +#include "../VFS/vfs.h" +#include <tqpopupmenu.h> +#include <tqdir.h> +#include <tdelocale.h> +#include <kiconloader.h> + +#include <kdebug.h> + +DirHistoryButton::DirHistoryButton( DirHistoryQueue* hQ, TQWidget *parent, const char *name ) : TQToolButton( parent, name ) { + TDEIconLoader * iconLoader = new TDEIconLoader(); + TQPixmap icon = iconLoader->loadIcon( "history", TDEIcon::Toolbar, 16 ); + + setFixedSize( icon.width() + 4, icon.height() + 4 ); + setPixmap( icon ); + setTextLabel( i18n( "Open the directory history list" ), true ); + setPopupDelay( 10 ); // 0.01 seconds press + setAcceptDrops( false ); + + popupMenu = new TQPopupMenu( this ); + TQ_CHECK_PTR( popupMenu ); + + setPopup( popupMenu ); + popupMenu->setCheckable( true ); + + historyQueue = hQ; + + connect( popupMenu, TQ_SIGNAL( aboutToShow() ), this, TQ_SLOT( slotAboutToShow() ) ); + connect( popupMenu, TQ_SIGNAL( activated( int ) ), this, TQ_SLOT( slotPopupActivated( int ) ) ); +} + +DirHistoryButton::~DirHistoryButton() {} + +void DirHistoryButton::openPopup() { + TQPopupMenu * pP = popup(); + if ( pP ) { + popup() ->exec( mapToGlobal( TQPoint( 0, height() ) ) ); + } +} +/** No descriptions */ +void DirHistoryButton::slotPopup() { + // kdDebug() << "History slot" << endl; +} +/** No descriptions */ +void DirHistoryButton::slotAboutToShow() { + // kdDebug() << "about to show" << endl; + popupMenu->clear(); + KURL::List::iterator it; + + int id = 0; + for ( it = historyQueue->urlQueue.begin(); it != historyQueue->urlQueue.end(); ++it ) { + popupMenu->insertItem( (*it).prettyURL(), id++ ); + } + if ( id > 0 ) { + popupMenu->setItemChecked( 0, true ); + } +} +/** No descriptions */ +void DirHistoryButton::slotPopupActivated( int id ) { + emit openUrl( historyQueue->urlQueue[ id ] ); +} + +#include "dirhistorybutton.moc" |