Commit 7e1526b9 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt, recents: elipse on the left the mrl

First, I ain't sure we should display the mrl and not a "nice version of it"
Then I ain't sure that we should elipse on the left...
But, this is a beginning... Improvements welcome.
parent 18dc9946
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include <QSettings> #include <QSettings>
#include <QRegExp> #include <QRegExp>
#include <QSignalMapper> #include <QSignalMapper>
#include <QFontMetrics>
#ifdef WIN32 #ifdef WIN32
#include <shlobj.h> #include <shlobj.h>
...@@ -90,8 +91,9 @@ void RecentsMRL::addRecent( const QString &mrl ) ...@@ -90,8 +91,9 @@ void RecentsMRL::addRecent( const QString &mrl )
/* Add to the Windows 7 default list in taskbar */ /* Add to the Windows 7 default list in taskbar */
SHAddToRecentDocs( SHARD_PATHW, qtu( mrl ) ); SHAddToRecentDocs( SHARD_PATHW, qtu( mrl ) );
#endif #endif
QString mrl2 = QApplication::fontMetrics().elidedText( mrl, Qt::ElideLeft, 400 );
int i_index = stack->indexOf( mrl ); int i_index = stack->indexOf( mrl2 );
if( 0 <= i_index ) if( 0 <= i_index )
{ {
/* move to the front */ /* move to the front */
...@@ -99,7 +101,7 @@ void RecentsMRL::addRecent( const QString &mrl ) ...@@ -99,7 +101,7 @@ void RecentsMRL::addRecent( const QString &mrl )
} }
else else
{ {
stack->prepend( mrl ); stack->prepend( mrl2 );
if( stack->size() > RECENTS_LIST_SIZE ) if( stack->size() > RECENTS_LIST_SIZE )
stack->takeLast(); stack->takeLast();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment