mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-24 02:42:48 +00:00
kdeui: format and indent
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
312c5a6268
commit
9acda75f99
2 changed files with 229 additions and 229 deletions
|
@ -40,78 +40,7 @@
|
||||||
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
KRecentFilesAction::KRecentFilesAction(QObject *parent)
|
static QString titleWithSensibleWidth(const QString &nameValue, const QString &value)
|
||||||
: KSelectAction(*new KRecentFilesActionPrivate, parent)
|
|
||||||
{
|
|
||||||
Q_D(KRecentFilesAction);
|
|
||||||
d->init();
|
|
||||||
}
|
|
||||||
|
|
||||||
KRecentFilesAction::KRecentFilesAction(const QString &text, QObject *parent)
|
|
||||||
: KSelectAction(*new KRecentFilesActionPrivate, parent)
|
|
||||||
{
|
|
||||||
Q_D(KRecentFilesAction);
|
|
||||||
d->init();
|
|
||||||
|
|
||||||
// Want to keep the ampersands
|
|
||||||
setText(text);
|
|
||||||
}
|
|
||||||
|
|
||||||
KRecentFilesAction::KRecentFilesAction(const KIcon &icon, const QString &text, QObject *parent)
|
|
||||||
: KSelectAction(*new KRecentFilesActionPrivate, parent)
|
|
||||||
{
|
|
||||||
Q_D(KRecentFilesAction);
|
|
||||||
d->init();
|
|
||||||
|
|
||||||
setIcon(icon);
|
|
||||||
// Want to keep the ampersands
|
|
||||||
setText(text);
|
|
||||||
}
|
|
||||||
|
|
||||||
void KRecentFilesActionPrivate::init()
|
|
||||||
{
|
|
||||||
Q_Q(KRecentFilesAction);
|
|
||||||
delete q->menu();
|
|
||||||
q->setMenu(new KMenu());
|
|
||||||
q->setToolBarMode(KSelectAction::MenuMode);
|
|
||||||
m_noEntriesAction = q->menu()->addAction(i18n("No Entries"));
|
|
||||||
m_noEntriesAction->setEnabled(false);
|
|
||||||
clearSeparator = q->menu()->addSeparator();
|
|
||||||
clearSeparator->setVisible(false);
|
|
||||||
clearAction = q->menu()->addAction(i18n("Clear List"), q, SLOT(clear()));
|
|
||||||
clearAction->setVisible(false);
|
|
||||||
q->setEnabled(false);
|
|
||||||
q->connect(q, SIGNAL(triggered(QAction*)), SLOT(_k_urlSelected(QAction*)));
|
|
||||||
}
|
|
||||||
|
|
||||||
KRecentFilesAction::~KRecentFilesAction()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void KRecentFilesActionPrivate::_k_urlSelected( QAction* action )
|
|
||||||
{
|
|
||||||
Q_Q(KRecentFilesAction);
|
|
||||||
emit q->urlSelected(m_urls[action]);
|
|
||||||
}
|
|
||||||
|
|
||||||
int KRecentFilesAction::maxItems() const
|
|
||||||
{
|
|
||||||
Q_D(const KRecentFilesAction);
|
|
||||||
return d->m_maxItems;
|
|
||||||
}
|
|
||||||
|
|
||||||
void KRecentFilesAction::setMaxItems( int maxItems )
|
|
||||||
{
|
|
||||||
Q_D(KRecentFilesAction);
|
|
||||||
// set new maxItems
|
|
||||||
d->m_maxItems = maxItems;
|
|
||||||
|
|
||||||
// remove all excess items
|
|
||||||
while( selectableActionGroup()->actions().count() > maxItems )
|
|
||||||
delete removeAction(selectableActionGroup()->actions().last());
|
|
||||||
}
|
|
||||||
|
|
||||||
static QString titleWithSensibleWidth(const QString& nameValue, const QString& value)
|
|
||||||
{
|
{
|
||||||
// Calculate 3/4 of screen geometry, we do not want
|
// Calculate 3/4 of screen geometry, we do not want
|
||||||
// action titles to be bigger than that
|
// action titles to be bigger than that
|
||||||
|
@ -143,7 +72,79 @@ static QString titleWithSensibleWidth(const QString& nameValue, const QString& v
|
||||||
return title;
|
return title;
|
||||||
}
|
}
|
||||||
|
|
||||||
void KRecentFilesAction::addUrl( const KUrl& _url, const QString& name )
|
KRecentFilesAction::KRecentFilesAction(QObject *parent)
|
||||||
|
: KSelectAction(*new KRecentFilesActionPrivate, parent)
|
||||||
|
{
|
||||||
|
Q_D(KRecentFilesAction);
|
||||||
|
d->init();
|
||||||
|
}
|
||||||
|
|
||||||
|
KRecentFilesAction::KRecentFilesAction(const QString &text, QObject *parent)
|
||||||
|
: KSelectAction(*new KRecentFilesActionPrivate, parent)
|
||||||
|
{
|
||||||
|
Q_D(KRecentFilesAction);
|
||||||
|
d->init();
|
||||||
|
|
||||||
|
// Want to keep the ampersands
|
||||||
|
setText(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
KRecentFilesAction::KRecentFilesAction(const KIcon &icon, const QString &text, QObject *parent)
|
||||||
|
: KSelectAction(*new KRecentFilesActionPrivate, parent)
|
||||||
|
{
|
||||||
|
Q_D(KRecentFilesAction);
|
||||||
|
d->init();
|
||||||
|
|
||||||
|
setIcon(icon);
|
||||||
|
// Want to keep the ampersands
|
||||||
|
setText(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
void KRecentFilesActionPrivate::init()
|
||||||
|
{
|
||||||
|
Q_Q(KRecentFilesAction);
|
||||||
|
delete q->menu();
|
||||||
|
q->setMenu(new KMenu());
|
||||||
|
q->setToolBarMode(KSelectAction::MenuMode);
|
||||||
|
m_noEntriesAction = q->menu()->addAction(i18n("No Entries"));
|
||||||
|
m_noEntriesAction->setEnabled(false);
|
||||||
|
clearSeparator = q->menu()->addSeparator();
|
||||||
|
clearSeparator->setVisible(false);
|
||||||
|
clearAction = q->menu()->addAction(i18n("Clear List"), q, SLOT(clear()));
|
||||||
|
clearAction->setVisible(false);
|
||||||
|
q->setEnabled(false);
|
||||||
|
q->connect(q, SIGNAL(triggered(QAction*)), SLOT(_k_urlSelected(QAction*)));
|
||||||
|
}
|
||||||
|
|
||||||
|
KRecentFilesAction::~KRecentFilesAction()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void KRecentFilesActionPrivate::_k_urlSelected(QAction *action)
|
||||||
|
{
|
||||||
|
Q_Q(KRecentFilesAction);
|
||||||
|
emit q->urlSelected(m_urls[action]);
|
||||||
|
}
|
||||||
|
|
||||||
|
int KRecentFilesAction::maxItems() const
|
||||||
|
{
|
||||||
|
Q_D(const KRecentFilesAction);
|
||||||
|
return d->m_maxItems;
|
||||||
|
}
|
||||||
|
|
||||||
|
void KRecentFilesAction::setMaxItems(int maxItems)
|
||||||
|
{
|
||||||
|
Q_D(KRecentFilesAction);
|
||||||
|
// set new maxItems
|
||||||
|
d->m_maxItems = maxItems;
|
||||||
|
|
||||||
|
// remove all excess items
|
||||||
|
while( selectableActionGroup()->actions().count() > maxItems) {
|
||||||
|
delete removeAction(selectableActionGroup()->actions().last());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void KRecentFilesAction::addUrl(const KUrl &_url, const QString &name)
|
||||||
{
|
{
|
||||||
Q_D(KRecentFilesAction);
|
Q_D(KRecentFilesAction);
|
||||||
/**
|
/**
|
||||||
|
@ -151,25 +152,23 @@ void KRecentFilesAction::addUrl( const KUrl& _url, const QString& name )
|
||||||
* urlSelected() signal, we will delete it in the removeAction() call below.
|
* urlSelected() signal, we will delete it in the removeAction() call below.
|
||||||
* but access it again in the addAction call... => crash
|
* but access it again in the addAction call... => crash
|
||||||
*/
|
*/
|
||||||
const KUrl url( _url );
|
const KUrl url(_url);
|
||||||
|
|
||||||
if ( url.isLocalFile() && KGlobal::dirs()->relativeLocation("tmp", url.toLocalFile()) != url.toLocalFile() )
|
if (url.isLocalFile() && KGlobal::dirs()->relativeLocation("tmp", url.toLocalFile()) != url.toLocalFile()) {
|
||||||
return;
|
return;
|
||||||
const QString tmpName = name.isEmpty() ? url.fileName() : name;
|
}
|
||||||
|
const QString tmpName = (name.isEmpty() ? url.fileName() : name);
|
||||||
const QString file = url.pathOrUrl();
|
const QString file = url.pathOrUrl();
|
||||||
|
|
||||||
// remove file if already in list
|
// remove file if already in list
|
||||||
foreach (QAction* action, selectableActionGroup()->actions())
|
foreach (QAction *action, selectableActionGroup()->actions()) {
|
||||||
{
|
if ( d->m_urls[action].pathOrUrl().endsWith(file)) {
|
||||||
if ( d->m_urls[action].pathOrUrl().endsWith(file) )
|
removeAction(action)->deleteLater();
|
||||||
{
|
break;
|
||||||
removeAction(action)->deleteLater();
|
}
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// remove oldest item if already maxitems in list
|
// remove oldest item if already maxitems in list
|
||||||
if( d->m_maxItems && selectableActionGroup()->actions().count() == d->m_maxItems )
|
if( d->m_maxItems && selectableActionGroup()->actions().count() == d->m_maxItems) {
|
||||||
{
|
|
||||||
// remove oldest added item
|
// remove oldest added item
|
||||||
delete removeAction(selectableActionGroup()->actions().first());
|
delete removeAction(selectableActionGroup()->actions().first());
|
||||||
}
|
}
|
||||||
|
@ -184,16 +183,17 @@ void KRecentFilesAction::addUrl( const KUrl& _url, const QString& name )
|
||||||
addAction(action, url, tmpName);
|
addAction(action, url, tmpName);
|
||||||
}
|
}
|
||||||
|
|
||||||
void KRecentFilesAction::addAction(QAction* action, const KUrl& url, const QString& name)
|
void KRecentFilesAction::addAction(QAction *action, const KUrl &url, const QString &name)
|
||||||
{
|
{
|
||||||
Q_D(KRecentFilesAction);
|
Q_D(KRecentFilesAction);
|
||||||
//kDebug (129) << "KRecentFilesAction::addAction(" << action << ")";
|
// kDebug (129) << "KRecentFilesAction::addAction(" << action << ")";
|
||||||
|
|
||||||
action->setActionGroup(selectableActionGroup());
|
action->setActionGroup(selectableActionGroup());
|
||||||
|
|
||||||
// Keep in sync with createToolBarWidget()
|
// Keep in sync with createToolBarWidget()
|
||||||
foreach (QToolButton* button, d->m_buttons)
|
foreach (QToolButton* button, d->m_buttons) {
|
||||||
button->insertAction(button->actions().value(0), action);
|
button->insertAction(button->actions().value(0), action);
|
||||||
|
}
|
||||||
|
|
||||||
foreach (KComboBox* comboBox, d->m_comboBoxes)
|
foreach (KComboBox* comboBox, d->m_comboBoxes)
|
||||||
comboBox->insertAction(comboBox->actions().value(0), action);
|
comboBox->insertAction(comboBox->actions().value(0), action);
|
||||||
|
@ -204,31 +204,30 @@ void KRecentFilesAction::addAction(QAction* action, const KUrl& url, const QStri
|
||||||
d->m_urls.insert( action, url );
|
d->m_urls.insert( action, url );
|
||||||
}
|
}
|
||||||
|
|
||||||
QAction* KRecentFilesAction::removeAction(QAction* action)
|
QAction* KRecentFilesAction::removeAction(QAction *action)
|
||||||
{
|
{
|
||||||
Q_D(KRecentFilesAction);
|
Q_D(KRecentFilesAction);
|
||||||
KSelectAction::removeAction( action );
|
KSelectAction::removeAction(action);
|
||||||
|
d->m_shortNames.remove(action);
|
||||||
d->m_shortNames.remove( action );
|
d->m_urls.remove(action);
|
||||||
d->m_urls.remove( action );
|
return action;
|
||||||
|
|
||||||
return action;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void KRecentFilesAction::removeUrl( const KUrl& url )
|
void KRecentFilesAction::removeUrl( const KUrl& url )
|
||||||
{
|
{
|
||||||
Q_D(KRecentFilesAction);
|
Q_D(KRecentFilesAction);
|
||||||
for (QMap<QAction*, KUrl>::ConstIterator it = d->m_urls.constBegin(); it != d->m_urls.constEnd(); ++it)
|
for (QMap<QAction*, KUrl>::ConstIterator it = d->m_urls.constBegin(); it != d->m_urls.constEnd(); ++it) {
|
||||||
if (it.value() == url) {
|
if (it.value() == url) {
|
||||||
delete removeAction(it.key());
|
delete removeAction(it.key());
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
KUrl::List KRecentFilesAction::urls() const
|
KUrl::List KRecentFilesAction::urls() const
|
||||||
{
|
{
|
||||||
Q_D(const KRecentFilesAction);
|
Q_D(const KRecentFilesAction);
|
||||||
return d->m_urls.values ();
|
return d->m_urls.values();
|
||||||
}
|
}
|
||||||
|
|
||||||
void KRecentFilesAction::clear()
|
void KRecentFilesAction::clear()
|
||||||
|
@ -249,51 +248,52 @@ void KRecentFilesAction::clearEntries()
|
||||||
setEnabled(false);
|
setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void KRecentFilesAction::loadEntries( const KConfigGroup& _config)
|
void KRecentFilesAction::loadEntries(const KConfigGroup &config)
|
||||||
{
|
{
|
||||||
Q_D(KRecentFilesAction);
|
Q_D(KRecentFilesAction);
|
||||||
clearEntries();
|
clearEntries();
|
||||||
|
|
||||||
QString key;
|
QString key;
|
||||||
QString value;
|
QString value;
|
||||||
QString nameKey;
|
QString nameKey;
|
||||||
QString nameValue;
|
QString nameValue;
|
||||||
QString title;
|
QString title;
|
||||||
KUrl url;
|
KUrl url;
|
||||||
|
|
||||||
KConfigGroup cg = _config;
|
KConfigGroup cg = config;
|
||||||
if ( cg.name().isEmpty())
|
if (cg.name().isEmpty()) {
|
||||||
cg = KConfigGroup(cg.config(),"RecentFiles");
|
cg = KConfigGroup(cg.config(), "RecentFiles");
|
||||||
|
}
|
||||||
|
|
||||||
bool thereAreEntries=false;
|
bool thereAreEntries = false;
|
||||||
// read file list
|
// read file list
|
||||||
for( int i = 1 ; i <= d->m_maxItems ; i++ )
|
for(int i = 1; i <= d->m_maxItems; i++) {
|
||||||
{
|
key = QString("File%1").arg(i);
|
||||||
key = QString( "File%1" ).arg( i );
|
value = cg.readPathEntry(key, QString());
|
||||||
value = cg.readPathEntry( key, QString() );
|
if (value.isEmpty()) {
|
||||||
if (value.isEmpty()) continue;
|
continue;
|
||||||
url = KUrl( value );
|
}
|
||||||
|
url = KUrl(value);
|
||||||
|
|
||||||
// Don't restore if file doesn't exist anymore
|
// Don't restore if file doesn't exist anymore
|
||||||
if (url.isLocalFile() && !QFile::exists(url.toLocalFile()))
|
if (url.isLocalFile() && !QFile::exists(url.toLocalFile())) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Don't restore where the url is already known (eg. broken config)
|
// Don't restore where the url is already known (eg. broken config)
|
||||||
if (d->m_urls.values().contains(url))
|
if (d->m_urls.values().contains(url)) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
nameKey = QString("Name%1").arg(i);
|
||||||
nameKey = QString( "Name%1" ).arg( i );
|
nameValue = cg.readPathEntry(nameKey, url.fileName());
|
||||||
nameValue = cg.readPathEntry( nameKey, url.fileName() );
|
|
||||||
title = titleWithSensibleWidth(nameValue, value);
|
title = titleWithSensibleWidth(nameValue, value);
|
||||||
if (!value.isNull())
|
if (!value.isNull()) {
|
||||||
{
|
|
||||||
thereAreEntries=true;
|
thereAreEntries=true;
|
||||||
addAction(new QAction(title, selectableActionGroup()), url, nameValue);
|
addAction(new QAction(title, selectableActionGroup()), url, nameValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (thereAreEntries)
|
if (thereAreEntries) {
|
||||||
{
|
|
||||||
d->m_noEntriesAction->setVisible(false);
|
d->m_noEntriesAction->setVisible(false);
|
||||||
d->clearSeparator->setVisible(true);
|
d->clearSeparator->setVisible(true);
|
||||||
d->clearAction->setVisible(true);
|
d->clearAction->setVisible(true);
|
||||||
|
@ -301,29 +301,29 @@ void KRecentFilesAction::loadEntries( const KConfigGroup& _config)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void KRecentFilesAction::saveEntries( const KConfigGroup &_cg )
|
void KRecentFilesAction::saveEntries(const KConfigGroup &_cg)
|
||||||
{
|
{
|
||||||
Q_D(KRecentFilesAction);
|
Q_D(KRecentFilesAction);
|
||||||
QString key;
|
QString key;
|
||||||
QString value;
|
QString value;
|
||||||
QStringList lst = items();
|
QStringList lst = items();
|
||||||
|
|
||||||
KConfigGroup cg = _cg;
|
KConfigGroup cg = _cg;
|
||||||
if (cg.name().isEmpty())
|
if (cg.name().isEmpty()) {
|
||||||
cg = KConfigGroup(cg.config(),"RecentFiles");
|
cg = KConfigGroup(cg.config(), "RecentFiles");
|
||||||
|
}
|
||||||
|
|
||||||
cg.deleteGroup();
|
cg.deleteGroup();
|
||||||
|
|
||||||
// write file list
|
// write file list
|
||||||
for ( int i = 1 ; i <= selectableActionGroup()->actions().count() ; i++ )
|
for (int i = 1 ; i <= selectableActionGroup()->actions().count(); i++) {
|
||||||
{
|
key = QString("File%1").arg(i);
|
||||||
key = QString( "File%1" ).arg( i );
|
|
||||||
// i - 1 because we started from 1
|
// i - 1 because we started from 1
|
||||||
value = d->m_urls[ selectableActionGroup()->actions()[ i - 1 ] ].pathOrUrl();
|
value = d->m_urls[ selectableActionGroup()->actions()[i - 1]].pathOrUrl();
|
||||||
cg.writePathEntry( key, value );
|
cg.writePathEntry(key, value);
|
||||||
key = QString( "Name%1" ).arg( i );
|
key = QString("Name%1" ).arg(i);
|
||||||
value = d->m_shortNames[ selectableActionGroup()->actions()[ i - 1 ] ];
|
value = d->m_shortNames[selectableActionGroup()->actions()[i - 1]];
|
||||||
cg.writePathEntry( key, value );
|
cg.writePathEntry(key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,9 +45,9 @@ class KRecentFilesActionPrivate;
|
||||||
*/
|
*/
|
||||||
class KDEUI_EXPORT KRecentFilesAction : public KSelectAction
|
class KDEUI_EXPORT KRecentFilesAction : public KSelectAction
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY( int maxItems READ maxItems WRITE setMaxItems )
|
Q_PROPERTY(int maxItems READ maxItems WRITE setMaxItems)
|
||||||
Q_DECLARE_PRIVATE(KRecentFilesAction)
|
Q_DECLARE_PRIVATE(KRecentFilesAction)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -84,97 +84,97 @@ public:
|
||||||
*/
|
*/
|
||||||
KRecentFilesAction(const KIcon &icon, const QString &text, QObject *parent);
|
KRecentFilesAction(const KIcon &icon, const QString &text, QObject *parent);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destructor.
|
* Destructor.
|
||||||
*/
|
*/
|
||||||
virtual ~KRecentFilesAction();
|
virtual ~KRecentFilesAction();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds \a action to the list of URLs, with \a url and title \a name.
|
* Adds \a action to the list of URLs, with \a url and title \a name.
|
||||||
*
|
*
|
||||||
* Do not use addAction(QAction*), as no url will be associated, and
|
* Do not use addAction(QAction*), as no url will be associated, and
|
||||||
* consequently urlSelected() will not be emitted when \a action is selected.
|
* consequently urlSelected() will not be emitted when \a action is selected.
|
||||||
*/
|
*/
|
||||||
void addAction(QAction* action, const KUrl& url, const QString& name);
|
void addAction(QAction *action, const KUrl &url, const QString &name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reimplemented for internal reasons.
|
* Reimplemented for internal reasons.
|
||||||
*/
|
*/
|
||||||
virtual QAction* removeAction(QAction* action);
|
virtual QAction* removeAction(QAction *action);
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
/**
|
/**
|
||||||
* Clears the recent files list.
|
* Clears the recent files list.
|
||||||
* Note that there is also an action shown to the user for clearing the list.
|
* Note that there is also an action shown to the user for clearing the list.
|
||||||
*/
|
*/
|
||||||
virtual void clear();
|
virtual void clear();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* Returns the maximum of items in the recent files list.
|
* Returns the maximum of items in the recent files list.
|
||||||
*/
|
*/
|
||||||
int maxItems() const;
|
int maxItems() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the maximum of items in the recent files list.
|
* Sets the maximum of items in the recent files list.
|
||||||
* The default for this value is 10 set in the constructor.
|
* The default for this value is 10 set in the constructor.
|
||||||
*
|
*
|
||||||
* If this value is lesser than the number of items currently
|
* If this value is lesser than the number of items currently
|
||||||
* in the recent files list the last items are deleted until
|
* in the recent files list the last items are deleted until
|
||||||
* the number of items are equal to the new maximum.
|
* the number of items are equal to the new maximum.
|
||||||
*/
|
*/
|
||||||
void setMaxItems( int maxItems );
|
void setMaxItems(int maxItems);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads the recent files entries from a given KConfigGroup object.
|
* Loads the recent files entries from a given KConfigGroup object.
|
||||||
* You can provide the name of the group used to load the entries.
|
* You can provide the name of the group used to load the entries.
|
||||||
* If the groupname is empty, entries are load from a group called 'RecentFiles'
|
* If the groupname is empty, entries are load from a group called 'RecentFiles'
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void loadEntries( const KConfigGroup &config );
|
void loadEntries(const KConfigGroup &config);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Saves the current recent files entries to a given KConfigGroup object.
|
* Saves the current recent files entries to a given KConfigGroup object.
|
||||||
* You can provide the name of the group used to load the entries.
|
* You can provide the name of the group used to load the entries.
|
||||||
* If the groupname is empty, entries are saved to a group called 'RecentFiles'
|
* If the groupname is empty, entries are saved to a group called 'RecentFiles'
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void saveEntries( const KConfigGroup &config );
|
void saveEntries(const KConfigGroup &config);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add URL to recent files list.
|
* Add URL to recent files list.
|
||||||
*
|
*
|
||||||
* @param url The URL of the file
|
* @param url The URL of the file
|
||||||
* @param name The user visible pretty name that appears before the URL
|
* @param name The user visible pretty name that appears before the URL
|
||||||
*/
|
*/
|
||||||
void addUrl( const KUrl& url, const QString& name = QString() );
|
void addUrl(const KUrl &url, const QString &name = QString());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove an URL from the recent files list.
|
* Remove an URL from the recent files list.
|
||||||
*
|
*
|
||||||
* @param url The URL of the file
|
* @param url The URL of the file
|
||||||
*/
|
*/
|
||||||
void removeUrl( const KUrl& url );
|
void removeUrl(const KUrl &url);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve a list of all URLs in the recent files list.
|
* Retrieve a list of all URLs in the recent files list.
|
||||||
*/
|
*/
|
||||||
KUrl::List urls() const;
|
KUrl::List urls() const;
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
/**
|
/**
|
||||||
* This signal gets emitted when the user selects an URL.
|
* This signal gets emitted when the user selects an URL.
|
||||||
*
|
*
|
||||||
* @param url The URL thats the user selected.
|
* @param url The URL thats the user selected.
|
||||||
*/
|
*/
|
||||||
void urlSelected( const KUrl& url );
|
void urlSelected(const KUrl &url);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This signal gets emitted when the user clear list.
|
* This signal gets emitted when the user clear list.
|
||||||
* So when user store url in specific config file it can saveEntry.
|
* So when user store url in specific config file it can saveEntry.
|
||||||
* @since 4.3
|
* @since 4.3
|
||||||
*/
|
*/
|
||||||
void recentListCleared();
|
void recentListCleared();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//Internal
|
//Internal
|
||||||
|
@ -183,7 +183,7 @@ private:
|
||||||
// addAction() says, addAction( QAction* ) should not be used.
|
// addAction() says, addAction( QAction* ) should not be used.
|
||||||
using KSelectAction::addAction;
|
using KSelectAction::addAction;
|
||||||
|
|
||||||
Q_PRIVATE_SLOT( d_func(), void _k_urlSelected(QAction*) )
|
Q_PRIVATE_SLOT(d_func(), void _k_urlSelected(QAction*))
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Reference in a new issue