28 #include <tderecentdirs.h>
29 #include <ksimpleconfig.h>
30 #include <kstandarddirs.h>
31 #include <tdeglobalsettings.h>
33 #define MAX_DIR_HISTORY 3
35 static void recentdirs_done(TDEConfig *config)
37 if (config == TDEGlobal::config())
47 static TDEConfig *recentdirs_readList(TQString &key, TQStringList &result,
bool readOnly)
50 if ((key.length() < 2) || (key[0] !=
':'))
55 config =
new KSimpleConfig(TQString::fromLatin1(
"tderecentdirsrc"), readOnly);
60 config = TDEGlobal::config();
61 config->setGroup(TQString::fromLatin1(
"Recent Dirs"));
64 result=config->readPathListEntry(key);
67 result.append(TDEGlobalSettings::documentPath());
74 TQString key = fileClass;
76 recentdirs_done(recentdirs_readList(key, result,
true));
82 TQStringList result =
list(fileClass);
88 TQString key = fileClass;
90 TDEConfig *config = recentdirs_readList(key, result,
false);
92 result.remove(directory);
93 result.prepend(directory);
94 while(result.count() > MAX_DIR_HISTORY)
95 result.remove(result.fromLast());
96 config->writePathEntry(key, result);
97 recentdirs_done(config);
static TQStringList list(const TQString &fileClass)
Returns a list of directories associated with this file-class.
static TQString dir(const TQString &fileClass)
Returns the most recently used directory accociated with this file-class.
static void add(const TQString &fileClass, const TQString &directory)
Associates directory with fileClass.