Commit c607f510 authored by Robert Knight's avatar Robert Knight
Browse files

Better short directory names in tab titles. Where common dir names are...

Better short directory names in tab titles.  Where common dir names are encountered at the end of the path, they are abbreviated to their first letter, and the search continues until a name not found in the set of common dir names is found.  eg.  '/path/to/konsole/src' and '/path/to/kate/src' are now abbreviated as 'konsole/s' and 'kate/s' respectively, instead of just 'src' in both cases.

svn path=/trunk/KDE/kdebase/apps/konsole/; revision=681390
parent ad4208b0
......@@ -50,16 +50,40 @@ The KDE 4.0 TODO List:
(Shift+<Arrows> and Shift+Tab)
- More intelligent tab title format which can adjust its output
to display more relevant information depending upon the
command being run. eg. If the current command is "svn"
then the operation ( checkout, update, remove etc. )
could be included as well.
- When composing the short directory name for the tab title,
add a means to strip or ignore common prefixes such
as 'src','build','tmp','bin','lib' etc. to provide better
differentiated tab titles when tabs are open in multiple
different directories.
If tabs are open in:
'%d' in tab titles would be replaced with 'konsole/s' and
'kate/s' instead of 'src' in both.
== BUGS ==
- Shortcuts do not word when the menu bar is hidden.
- Alt modifiers cannot be used to access menu items because they are
used by the terminal.
- Shortcuts do not work when the menu bar is hidden.
- Allow the user to over-ride the "no Ctrl+[Key] shortcuts" limitation with shortcuts
set in the configuration dialog, but warn the user if they try to do so. This is the
......@@ -27,6 +27,7 @@
// Qt
#include <QtCore/QDebug>
#include <QtCore/QDir>
#include <QtCore/QFile>
#include <QtCore/QFileInfo>
#include <QtCore/QRegExp>
......@@ -65,7 +66,7 @@ QString ProcessInfo::format(const QString& input) const
output.replace("%u","NOT IMPLEMENTED YET");
// remove any remaining %[LETTER] sequences
// output.replace(QRegExp("%\\w"),QString::null);
......@@ -73,6 +74,42 @@ QString ProcessInfo::format(const QString& input) const
return output;
QString ProcessInfo::formatShortDir(const QString& input) const
QString result;
QStringList parts = input.split( QDir::separator() );
// temporarily hard-coded
QSet<QString> commonDirNames;
commonDirNames << "src" << "build" << "bin"
<< "lib" << "tmp";
QListIterator<QString> iter(parts);
// go backwards through the list of the path's parts
// adding abbreviations of common directory names
// and stopping when we reach a dir name which is not
// in the commonDirNames set
while ( iter.hasPrevious() )
QString part = iter.previous();
if ( commonDirNames.contains(part) )
result.prepend(QDir::separator() + part[0]);
return result;
QVector<QString> ProcessInfo::arguments(bool* ok) const
*ok = _fields & ARGUMENTS;
......@@ -232,7 +232,11 @@ protected:
// takes a full directory path and returns a
// shortened version suitable for display in
// space-constrained UI elements (eg. tabs)
QString formatShortDir(const QString& dirPath) const;
// valid bits for _fields variable, ensure that
// _fields is changed to an int if more than 8 fields are added
Supports Markdown
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