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/dirhistoryqueue.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/dirhistoryqueue.cpp')
-rw-r--r-- | src/app/GUI/dirhistoryqueue.cpp | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/src/app/GUI/dirhistoryqueue.cpp b/src/app/GUI/dirhistoryqueue.cpp new file mode 100644 index 0000000..08c384e --- /dev/null +++ b/src/app/GUI/dirhistoryqueue.cpp @@ -0,0 +1,87 @@ +/*************************************************************************** + dirhistoryqueue.cpp - description + ------------------- + begin : Thu Jan 1 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 "dirhistoryqueue.h" +#include "../Panel/listpanel.h" + +#include <kdebug.h> + +DirHistoryQueue::DirHistoryQueue( ListPanel* p ) { + panel = p; + + connect( panel, TQ_SIGNAL( pathChanged( ListPanel* ) ), this, TQ_SLOT( slotPathChanged( ListPanel* ) ) ); +} +DirHistoryQueue::~DirHistoryQueue() {} + +/** No descriptions */ +void DirHistoryQueue::slotPathChanged( ListPanel* p ) { + KURL url = p->virtualPath(); + // already in the queue ? + if( urlQueue.findIndex( url ) >= 0 ){ + // remove it ! + urlQueue.remove( url ); + } + // do we have room for another ? + if ( urlQueue.size() > 12 ) { + // no room - remove the oldest entry + urlQueue.pop_back(); + } + + urlQueue.push_front( url ); +} + +#if 0 +void DirHistoryQueue::addUrl(const KURL& url){ + if ( pathQueue.findIndex( path ) == -1 ) { + if ( pathQueue.size() > 12 ) { + // remove the oldest entry + pathQueue.pop_back(); + } + } else { + pathQueue.remove( path ); + } + + pathQueue.push_front( path ); +} + +void DirHistoryQueue::RemovePath( const TQString& path ) { + TQStringList::iterator it; + it = pathQueue.find( path ); + if ( it != pathQueue.end() ) { + pathQueue.remove( it ); + } +} + +bool DirHistoryQueue::checkPath( const TQString& path ) { + KURL url( path ); + + TQString p = url.path(); + // kdDebug() << "url:" << p << ", file: " << url.fileName() << ", dir: " << url.directory() << endl; + if ( url.protocol() == "file" ) { + TQDir dir( path ); + if ( !dir.exists() ) { + RemovePath( path ); + return false; + } + } + + return true; + +} +#endif + +#include "dirhistoryqueue.moc" |