mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-24 10:52:49 +00:00
generic: format kimageio and krecentdirs source/header files
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
470d7f91f9
commit
669c8caa3b
4 changed files with 37 additions and 38 deletions
|
@ -84,7 +84,7 @@ QStringList KImageIO::types(Mode mode)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool KImageIO::isSupported(const QString& mimeType, Mode mode)
|
bool KImageIO::isSupported(const QString &mimeType, Mode mode)
|
||||||
{
|
{
|
||||||
if (mimeType.isEmpty()) {
|
if (mimeType.isEmpty()) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -58,7 +58,7 @@ namespace KImageIO
|
||||||
* @return type id(s) of the MIME type or QStringList() if the MIME type
|
* @return type id(s) of the MIME type or QStringList() if the MIME type
|
||||||
* is not supported
|
* is not supported
|
||||||
*/
|
*/
|
||||||
KDEUI_EXPORT QStringList typeForMime(const QString& mimeType);
|
KDEUI_EXPORT QStringList typeForMime(const QString &mimeType);
|
||||||
/**
|
/**
|
||||||
* Returns a list of all KImageIO supported formats.
|
* Returns a list of all KImageIO supported formats.
|
||||||
*
|
*
|
||||||
|
@ -81,7 +81,7 @@ namespace KImageIO
|
||||||
* @param _mode Tells whether to check for reading or writing capabilities
|
* @param _mode Tells whether to check for reading or writing capabilities
|
||||||
* @return true if the type is supported
|
* @return true if the type is supported
|
||||||
**/
|
**/
|
||||||
KDEUI_EXPORT bool isSupported(const QString& mimeType, Mode mode = Writing);
|
KDEUI_EXPORT bool isSupported(const QString &mimeType, Mode mode = Writing);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // KIMAGEIO_H
|
#endif // KIMAGEIO_H
|
||||||
|
|
|
@ -587,7 +587,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Map a Qt filter string into a KDE one.
|
* Map a Katie filter string into a KDE one.
|
||||||
*/
|
*/
|
||||||
static QString qt2KdeFilter(const QString &f)
|
static QString qt2KdeFilter(const QString &f)
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#include "krecentdirs.h"
|
#include "krecentdirs.h"
|
||||||
|
|
||||||
#include <kconfig.h>
|
#include <kconfig.h>
|
||||||
#include <kconfiggroup.h>
|
#include <kconfiggroup.h>
|
||||||
#include <ksharedconfig.h>
|
#include <ksharedconfig.h>
|
||||||
|
@ -36,52 +37,50 @@
|
||||||
|
|
||||||
static KConfigGroup recentdirs_readList(QString &key, QStringList &result)
|
static KConfigGroup recentdirs_readList(QString &key, QStringList &result)
|
||||||
{
|
{
|
||||||
KConfigGroup cg(KGlobal::config(), QLatin1String("Recent Dirs"));
|
KConfigGroup cg(KGlobal::config(), QLatin1String("Recent Dirs"));
|
||||||
if ((key.length() < 2) || (key[0] != ':'))
|
if (key.length() < 2 || key[0] != QLatin1Char(':')) {
|
||||||
key = ":default";
|
key = ":default";
|
||||||
if (key[1] == ':')
|
}
|
||||||
{
|
if (key[1] == ':') {
|
||||||
key = key.mid(2);
|
key = key.mid(2);
|
||||||
cg = KConfigGroup(KSharedConfig::openConfig(QLatin1String("krecentdirsrc")), QString());
|
cg = KConfigGroup(KSharedConfig::openConfig(QLatin1String("krecentdirsrc")), QString());
|
||||||
}
|
} else {
|
||||||
else
|
key = key.mid(1);
|
||||||
{
|
}
|
||||||
key = key.mid(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
result=cg.readPathEntry(key, QStringList());
|
result = cg.readPathEntry(key, QStringList());
|
||||||
if (result.isEmpty())
|
if (result.isEmpty()) {
|
||||||
{
|
result.append(KGlobalSettings::documentPath());
|
||||||
result.append(KGlobalSettings::documentPath());
|
}
|
||||||
}
|
return cg;
|
||||||
return cg;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList KRecentDirs::list(const QString &fileClass)
|
QStringList KRecentDirs::list(const QString &fileClass)
|
||||||
{
|
{
|
||||||
QString key = fileClass;
|
QString key = fileClass;
|
||||||
QStringList result;
|
QStringList result;
|
||||||
recentdirs_readList(key, result).sync();
|
recentdirs_readList(key, result).sync();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString KRecentDirs::dir(const QString &fileClass)
|
QString KRecentDirs::dir(const QString &fileClass)
|
||||||
{
|
{
|
||||||
const QStringList result = list(fileClass);
|
const QStringList result = list(fileClass);
|
||||||
return result[0];
|
return result[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
void KRecentDirs::add(const QString &fileClass, const QString &directory)
|
void KRecentDirs::add(const QString &fileClass, const QString &directory)
|
||||||
{
|
{
|
||||||
QString key = fileClass;
|
QString key = fileClass;
|
||||||
QStringList result;
|
QStringList result;
|
||||||
KConfigGroup config = recentdirs_readList(key, result);
|
KConfigGroup config = recentdirs_readList(key, result);
|
||||||
// make sure the dir is first in history
|
// make sure the dir is first in history
|
||||||
result.removeAll(directory);
|
result.removeAll(directory);
|
||||||
result.prepend(directory);
|
result.prepend(directory);
|
||||||
while(result.count() > MAX_DIR_HISTORY)
|
while(result.count() > MAX_DIR_HISTORY) {
|
||||||
result.removeLast();
|
result.removeLast();
|
||||||
config.writePathEntry(key, result);
|
}
|
||||||
config.sync();
|
config.writePathEntry(key, result);
|
||||||
|
config.sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue