mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-24 02:42:48 +00:00
kio: format and indent
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
7b38e92e43
commit
af7077a0a3
3 changed files with 758 additions and 761 deletions
|
@ -132,8 +132,9 @@ using namespace KDEPrivate;
|
||||||
|
|
||||||
static QString nameFromFileName(QString nameStr)
|
static QString nameFromFileName(QString nameStr)
|
||||||
{
|
{
|
||||||
if ( nameStr.endsWith(QLatin1String(".desktop")) )
|
if (nameStr.endsWith(QLatin1String(".desktop"))) {
|
||||||
nameStr.truncate(nameStr.length() - 8);
|
nameStr.truncate(nameStr.length() - 8);
|
||||||
|
}
|
||||||
// Make it human-readable (%2F => '/', ...)
|
// Make it human-readable (%2F => '/', ...)
|
||||||
return KIO::decodeFileName(nameStr);
|
return KIO::decodeFileName(nameStr);
|
||||||
}
|
}
|
||||||
|
@ -188,9 +189,9 @@ public:
|
||||||
QList<KPropertiesDialogPlugin*> m_pageList;
|
QList<KPropertiesDialogPlugin*> m_pageList;
|
||||||
};
|
};
|
||||||
|
|
||||||
KPropertiesDialog::KPropertiesDialog (const KFileItem& item,
|
KPropertiesDialog::KPropertiesDialog(const KFileItem &item, QWidget *parent)
|
||||||
QWidget* parent)
|
: KPageDialog(parent),
|
||||||
: KPageDialog(parent), d(new KPropertiesDialogPrivate(this))
|
d(new KPropertiesDialogPrivate(this))
|
||||||
{
|
{
|
||||||
setCaption(i18n("Properties for %1", KIO::decodeFileName(item.url().fileName())));
|
setCaption(i18n("Properties for %1", KIO::decodeFileName(item.url().fileName())));
|
||||||
|
|
||||||
|
@ -203,58 +204,59 @@ KPropertiesDialog::KPropertiesDialog (const KFileItem& item,
|
||||||
d->init();
|
d->init();
|
||||||
}
|
}
|
||||||
|
|
||||||
KPropertiesDialog::KPropertiesDialog (const QString& title,
|
KPropertiesDialog::KPropertiesDialog(const QString &title, QWidget *parent)
|
||||||
QWidget* parent)
|
: KPageDialog(parent),
|
||||||
: KPageDialog(parent), d(new KPropertiesDialogPrivate(this))
|
d(new KPropertiesDialogPrivate(this))
|
||||||
{
|
{
|
||||||
setCaption(i18n("Properties for %1", title));
|
setCaption(i18n("Properties for %1", title));
|
||||||
|
|
||||||
d->init();
|
d->init();
|
||||||
}
|
}
|
||||||
|
|
||||||
KPropertiesDialog::KPropertiesDialog(const KFileItemList& _items,
|
KPropertiesDialog::KPropertiesDialog(const KFileItemList &items, QWidget *parent)
|
||||||
QWidget* parent)
|
: KPageDialog(parent),
|
||||||
: KPageDialog(parent), d(new KPropertiesDialogPrivate(this))
|
d(new KPropertiesDialogPrivate(this))
|
||||||
{
|
{
|
||||||
if ( _items.count() > 1 )
|
if (items.count() > 1) {
|
||||||
setCaption( i18np( "Properties for 1 item", "Properties for %1 Selected Items", _items.count() ) );
|
setCaption(i18np("Properties for 1 item", "Properties for %1 Selected Items", items.count()));
|
||||||
else
|
} else {
|
||||||
setCaption( i18n( "Properties for %1" , KIO::decodeFileName(_items.first().url().fileName())) );
|
setCaption(i18n("Properties for %1", KIO::decodeFileName(items.first().url().fileName())));
|
||||||
|
}
|
||||||
|
|
||||||
Q_ASSERT( !_items.isEmpty() );
|
Q_ASSERT(!items.isEmpty());
|
||||||
d->m_singleUrl = _items.first().url();
|
d->m_singleUrl = items.first().url();
|
||||||
Q_ASSERT(!d->m_singleUrl.isEmpty());
|
Q_ASSERT(!d->m_singleUrl.isEmpty());
|
||||||
|
|
||||||
d->m_items = _items;
|
d->m_items = items;
|
||||||
|
|
||||||
d->init();
|
d->init();
|
||||||
}
|
}
|
||||||
|
|
||||||
KPropertiesDialog::KPropertiesDialog (const KUrl& _url,
|
KPropertiesDialog::KPropertiesDialog(const KUrl &url, QWidget* parent)
|
||||||
QWidget* parent)
|
: KPageDialog(parent),
|
||||||
: KPageDialog(parent), d(new KPropertiesDialogPrivate(this))
|
d(new KPropertiesDialogPrivate(this))
|
||||||
{
|
{
|
||||||
setCaption( i18n( "Properties for %1" , KIO::decodeFileName(_url.fileName())) );
|
setCaption(i18n("Properties for %1", KIO::decodeFileName(url.fileName())));
|
||||||
|
|
||||||
d->m_singleUrl = _url;
|
d->m_singleUrl = url;
|
||||||
|
|
||||||
KIO::UDSEntry entry;
|
KIO::UDSEntry entry;
|
||||||
KIO::NetAccess::stat(_url, entry, parent);
|
KIO::NetAccess::stat(url, entry, parent);
|
||||||
|
|
||||||
d->m_items.append(KFileItem(entry, _url));
|
d->m_items.append(KFileItem(entry, url));
|
||||||
d->init();
|
d->init();
|
||||||
}
|
}
|
||||||
|
|
||||||
KPropertiesDialog::KPropertiesDialog (const KUrl& _tempUrl, const KUrl& _currentDir,
|
KPropertiesDialog::KPropertiesDialog(const KUrl &tempUrl, const KUrl ¤tDir,
|
||||||
const QString& _defaultName,
|
const QString &defaultName, QWidget *parent)
|
||||||
QWidget* parent)
|
: KPageDialog(parent),
|
||||||
: KPageDialog(parent), d(new KPropertiesDialogPrivate(this))
|
d(new KPropertiesDialogPrivate(this))
|
||||||
{
|
{
|
||||||
setCaption( i18n( "Properties for %1" , KIO::decodeFileName(_tempUrl.fileName())) );
|
setCaption(i18n("Properties for %1" , KIO::decodeFileName(tempUrl.fileName())));
|
||||||
|
|
||||||
d->m_singleUrl = _tempUrl;
|
d->m_singleUrl = tempUrl;
|
||||||
d->m_defaultName = _defaultName;
|
d->m_defaultName = defaultName;
|
||||||
d->m_currentDir = _currentDir;
|
d->m_currentDir = currentDir;
|
||||||
Q_ASSERT(!d->m_singleUrl.isEmpty());
|
Q_ASSERT(!d->m_singleUrl.isEmpty());
|
||||||
|
|
||||||
// Create the KFileItem for the _template_ file, in order to read from it.
|
// Create the KFileItem for the _template_ file, in order to read from it.
|
||||||
|
@ -262,8 +264,7 @@ KPropertiesDialog::KPropertiesDialog (const KUrl& _tempUrl, const KUrl& _current
|
||||||
d->init();
|
d->init();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool KPropertiesDialog::showDialog(const KFileItem& item, QWidget* parent,
|
bool KPropertiesDialog::showDialog(const KFileItem &item, QWidget *parent, bool modal)
|
||||||
bool modal)
|
|
||||||
{
|
{
|
||||||
// TODO: do we really want to show the win32 property dialog?
|
// TODO: do we really want to show the win32 property dialog?
|
||||||
// This means we lose metainfo, support for .desktop files, etc. (DF)
|
// This means we lose metainfo, support for .desktop files, etc. (DF)
|
||||||
|
@ -273,35 +274,31 @@ bool KPropertiesDialog::showDialog(const KFileItem& item, QWidget* parent,
|
||||||
} else {
|
} else {
|
||||||
dlg->show();
|
dlg->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool KPropertiesDialog::showDialog(const KUrl& _url, QWidget* parent,
|
bool KPropertiesDialog::showDialog(const KUrl &url, QWidget *parent, bool modal)
|
||||||
bool modal)
|
|
||||||
{
|
{
|
||||||
KPropertiesDialog* dlg = new KPropertiesDialog(_url, parent);
|
KPropertiesDialog* dlg = new KPropertiesDialog(url, parent);
|
||||||
if (modal) {
|
if (modal) {
|
||||||
dlg->exec();
|
dlg->exec();
|
||||||
} else {
|
} else {
|
||||||
dlg->show();
|
dlg->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool KPropertiesDialog::showDialog(const KFileItemList& _items, QWidget* parent,
|
bool KPropertiesDialog::showDialog(const KFileItemList &items, QWidget *parent, bool modal)
|
||||||
bool modal)
|
|
||||||
{
|
{
|
||||||
if (_items.count()==1) {
|
if (items.count() == 1) {
|
||||||
const KFileItem item = _items.first();
|
const KFileItem item = items.first();
|
||||||
if (item.entry().count() == 0 && item.localPath().isEmpty()) // this remote item wasn't listed by a slave
|
if (item.entry().count() == 0 && item.localPath().isEmpty()) {
|
||||||
// Let's stat to get more info on the file
|
// this remote item wasn't listed by a slave, let's stat to get more info on the file
|
||||||
return KPropertiesDialog::showDialog(item.url(), parent, modal);
|
return KPropertiesDialog::showDialog(item.url(), parent, modal);
|
||||||
else
|
|
||||||
return KPropertiesDialog::showDialog(_items.first(), parent, modal);
|
|
||||||
}
|
}
|
||||||
KPropertiesDialog* dlg = new KPropertiesDialog(_items, parent);
|
return KPropertiesDialog::showDialog(items.first(), parent, modal);
|
||||||
|
}
|
||||||
|
KPropertiesDialog* dlg = new KPropertiesDialog(items, parent);
|
||||||
if (modal) {
|
if (modal) {
|
||||||
dlg->exec();
|
dlg->exec();
|
||||||
} else {
|
} else {
|
||||||
|
@ -333,11 +330,11 @@ void KPropertiesDialog::showFileSharingPage()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void KPropertiesDialog::setFileSharingPage(QWidget* page) {
|
void KPropertiesDialog::setFileSharingPage(QWidget* page)
|
||||||
|
{
|
||||||
d->fileSharePage = page;
|
d->fileSharePage = page;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void KPropertiesDialog::setFileNameReadOnly(bool ro)
|
void KPropertiesDialog::setFileNameReadOnly(bool ro)
|
||||||
{
|
{
|
||||||
foreach(KPropertiesDialogPlugin *it, d->m_pageList) {
|
foreach(KPropertiesDialogPlugin *it, d->m_pageList) {
|
||||||
|
@ -360,8 +357,7 @@ KPropertiesDialog::~KPropertiesDialog()
|
||||||
|
|
||||||
void KPropertiesDialog::insertPlugin(KPropertiesDialogPlugin* plugin)
|
void KPropertiesDialog::insertPlugin(KPropertiesDialogPlugin* plugin)
|
||||||
{
|
{
|
||||||
connect (plugin, SIGNAL (changed()),
|
connect(plugin, SIGNAL (changed()), plugin, SLOT (setDirty()));
|
||||||
plugin, SLOT (setDirty()));
|
|
||||||
|
|
||||||
d->m_pageList.append(plugin);
|
d->m_pageList.append(plugin);
|
||||||
}
|
}
|
||||||
|
@ -391,16 +387,16 @@ QString KPropertiesDialog::defaultName() const
|
||||||
return d->m_defaultName;
|
return d->m_defaultName;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool KPropertiesDialog::canDisplay( const KFileItemList& _items )
|
bool KPropertiesDialog::canDisplay(const KFileItemList &items)
|
||||||
{
|
{
|
||||||
// TODO: cache the result of those calls. Currently we parse .desktop files far too many times
|
// TODO: cache the result of those calls. Currently we parse .desktop files far too many times
|
||||||
return KFilePropsPlugin::supports( _items ) ||
|
return KFilePropsPlugin::supports(items) ||
|
||||||
KFilePermissionsPropsPlugin::supports( _items ) ||
|
KFilePermissionsPropsPlugin::supports(items) ||
|
||||||
KDesktopPropsPlugin::supports( _items ) ||
|
KDesktopPropsPlugin::supports(items) ||
|
||||||
KUrlPropsPlugin::supports( _items ) ||
|
KUrlPropsPlugin::supports(items) ||
|
||||||
KDevicePropsPlugin::supports( _items ) ||
|
KDevicePropsPlugin::supports(items) ||
|
||||||
KPreviewPropsPlugin::supports( _items ) ||
|
KPreviewPropsPlugin::supports(items) ||
|
||||||
KFileMetaPropsPlugin::supports( _items );
|
KFileMetaPropsPlugin::supports(items);
|
||||||
}
|
}
|
||||||
|
|
||||||
void KPropertiesDialog::slotOk()
|
void KPropertiesDialog::slotOk()
|
||||||
|
@ -414,8 +410,7 @@ void KPropertiesDialog::slotOk()
|
||||||
// dirty too. This is what makes it possible to save changes to a global
|
// dirty too. This is what makes it possible to save changes to a global
|
||||||
// desktop file into a local one. In other cases, it doesn't hurt.
|
// desktop file into a local one. In other cases, it doesn't hurt.
|
||||||
for (pageListIt = d->m_pageList.constBegin(); pageListIt != d->m_pageList.constEnd(); ++pageListIt) {
|
for (pageListIt = d->m_pageList.constBegin(); pageListIt != d->m_pageList.constEnd(); ++pageListIt) {
|
||||||
if ( (*pageListIt)->isDirty() && filePropsPlugin )
|
if ((*pageListIt)->isDirty() && filePropsPlugin) {
|
||||||
{
|
|
||||||
filePropsPlugin->setDirty();
|
filePropsPlugin->setDirty();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -426,22 +421,20 @@ void KPropertiesDialog::slotOk()
|
||||||
// KPropertiesDialog::rename, so other tab will be ok with whatever order
|
// KPropertiesDialog::rename, so other tab will be ok with whatever order
|
||||||
// BUT for file copied from templates, we need to do the renaming first !
|
// BUT for file copied from templates, we need to do the renaming first !
|
||||||
for (pageListIt = d->m_pageList.constBegin(); pageListIt != d->m_pageList.constEnd() && !d->m_aborted; ++pageListIt) {
|
for (pageListIt = d->m_pageList.constBegin(); pageListIt != d->m_pageList.constEnd() && !d->m_aborted; ++pageListIt) {
|
||||||
if ( (*pageListIt)->isDirty() )
|
if ((*pageListIt)->isDirty()) {
|
||||||
{
|
|
||||||
kDebug(250) << "applying changes for" << (*pageListIt)->metaObject()->className();
|
kDebug(250) << "applying changes for" << (*pageListIt)->metaObject()->className();
|
||||||
(*pageListIt)->applyChanges();
|
(*pageListIt)->applyChanges();
|
||||||
// applyChanges may change d->m_aborted.
|
// applyChanges may change d->m_aborted.
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
kDebug(250) << "skipping page " << (*pageListIt)->metaObject()->className();
|
kDebug(250) << "skipping page " << (*pageListIt)->metaObject()->className();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !d->m_aborted && filePropsPlugin )
|
if (!d->m_aborted && filePropsPlugin) {
|
||||||
filePropsPlugin->postApplyChanges();
|
filePropsPlugin->postApplyChanges();
|
||||||
|
}
|
||||||
|
|
||||||
if ( !d->m_aborted )
|
if (!d->m_aborted) {
|
||||||
{
|
|
||||||
emit applied();
|
emit applied();
|
||||||
emit propertiesClosed();
|
emit propertiesClosed();
|
||||||
deleteLater(); // somewhat like Qt::WA_DeleteOnClose would do.
|
deleteLater(); // somewhat like Qt::WA_DeleteOnClose would do.
|
||||||
|
@ -455,13 +448,14 @@ void KPropertiesDialog::slotCancel()
|
||||||
emit propertiesClosed();
|
emit propertiesClosed();
|
||||||
|
|
||||||
deleteLater();
|
deleteLater();
|
||||||
done( Rejected );
|
done(QDialog::Rejected);
|
||||||
}
|
}
|
||||||
|
|
||||||
void KPropertiesDialog::KPropertiesDialogPrivate::insertPages()
|
void KPropertiesDialog::KPropertiesDialogPrivate::insertPages()
|
||||||
{
|
{
|
||||||
if (m_items.isEmpty())
|
if (m_items.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (KFilePropsPlugin::supports(m_items)) {
|
if (KFilePropsPlugin::supports(m_items)) {
|
||||||
KPropertiesDialogPlugin *p = new KFilePropsPlugin(q);
|
KPropertiesDialogPlugin *p = new KFilePropsPlugin(q);
|
||||||
|
@ -500,14 +494,16 @@ void KPropertiesDialog::KPropertiesDialogPrivate::insertPages()
|
||||||
|
|
||||||
//plugins
|
//plugins
|
||||||
|
|
||||||
if ( m_items.count() != 1 )
|
if (m_items.count() != 1) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const KFileItem item = m_items.first();
|
const KFileItem item = m_items.first();
|
||||||
const QString mimetype = item.mimetype();
|
const QString mimetype = item.mimetype();
|
||||||
|
|
||||||
if ( mimetype.isEmpty() )
|
if (mimetype.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
QString query = QString::fromLatin1(
|
QString query = QString::fromLatin1(
|
||||||
"((not exist [X-KDE-Protocol]) or "
|
"((not exist [X-KDE-Protocol]) or "
|
||||||
|
@ -518,8 +514,9 @@ void KPropertiesDialog::KPropertiesDialogPrivate::insertPages()
|
||||||
const KService::List offers = KMimeTypeTrader::self()->query(mimetype, "KPropertiesDialog/Plugin", query);
|
const KService::List offers = KMimeTypeTrader::self()->query(mimetype, "KPropertiesDialog/Plugin", query);
|
||||||
foreach (const KService::Ptr &ptr, offers) {
|
foreach (const KService::Ptr &ptr, offers) {
|
||||||
KPropertiesDialogPlugin *plugin = ptr->createInstance<KPropertiesDialogPlugin>(q);
|
KPropertiesDialogPlugin *plugin = ptr->createInstance<KPropertiesDialogPlugin>(q);
|
||||||
if (!plugin)
|
if (!plugin) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
plugin->setObjectName(ptr->name());
|
plugin->setObjectName(ptr->name());
|
||||||
|
|
||||||
q->insertPlugin(plugin);
|
q->insertPlugin(plugin);
|
||||||
|
@ -550,15 +547,15 @@ void KPropertiesDialog::updateUrl( const KUrl& _newUrl )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void KPropertiesDialog::rename( const QString& _name )
|
void KPropertiesDialog::rename(const QString &name)
|
||||||
{
|
{
|
||||||
Q_ASSERT(d->m_items.count() == 1);
|
Q_ASSERT(d->m_items.count() == 1);
|
||||||
kDebug(250) << "KPropertiesDialog::rename " << _name;
|
kDebug(250) << "KPropertiesDialog::rename " << name;
|
||||||
KUrl newUrl;
|
KUrl newUrl;
|
||||||
// if we're creating from a template : use currentdir
|
// if we're creating from a template : use currentdir
|
||||||
if (!d->m_currentDir.isEmpty()) {
|
if (!d->m_currentDir.isEmpty()) {
|
||||||
newUrl = d->m_currentDir;
|
newUrl = d->m_currentDir;
|
||||||
newUrl.addPath(_name);
|
newUrl.addPath(name);
|
||||||
} else {
|
} else {
|
||||||
QString tmpurl = d->m_singleUrl.url();
|
QString tmpurl = d->m_singleUrl.url();
|
||||||
if (!tmpurl.isEmpty() && tmpurl.at(tmpurl.length() - 1) == '/') {
|
if (!tmpurl.isEmpty() && tmpurl.at(tmpurl.length() - 1) == '/') {
|
||||||
|
@ -567,7 +564,7 @@ void KPropertiesDialog::rename( const QString& _name )
|
||||||
}
|
}
|
||||||
|
|
||||||
newUrl = tmpurl;
|
newUrl = tmpurl;
|
||||||
newUrl.setFileName(_name);
|
newUrl.setFileName(name);
|
||||||
}
|
}
|
||||||
updateUrl(newUrl);
|
updateUrl(newUrl);
|
||||||
}
|
}
|
||||||
|
@ -589,11 +586,11 @@ public:
|
||||||
int fontHeight;
|
int fontHeight;
|
||||||
};
|
};
|
||||||
|
|
||||||
KPropertiesDialogPlugin::KPropertiesDialogPlugin( KPropertiesDialog *_props )
|
KPropertiesDialogPlugin::KPropertiesDialogPlugin(KPropertiesDialog *props)
|
||||||
: QObject( _props ),
|
: QObject(props),
|
||||||
d(new KPropertiesDialogPluginPrivate())
|
d(new KPropertiesDialogPluginPrivate())
|
||||||
{
|
{
|
||||||
properties = _props;
|
properties = props;
|
||||||
d->fontHeight = 2*properties->fontMetrics().height();
|
d->fontHeight = 2*properties->fontMetrics().height();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -602,7 +599,6 @@ KPropertiesDialogPlugin::~KPropertiesDialogPlugin()
|
||||||
delete d;
|
delete d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void KPropertiesDialogPlugin::setDirty(bool b)
|
void KPropertiesDialogPlugin::setDirty(bool b)
|
||||||
{
|
{
|
||||||
d->m_bDirty = b;
|
d->m_bDirty = b;
|
||||||
|
@ -634,18 +630,20 @@ class KFilePropsPlugin::KFilePropsPluginPrivate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
KFilePropsPluginPrivate()
|
KFilePropsPluginPrivate()
|
||||||
|
: dirSizeJob(nullptr),
|
||||||
|
dirSizeUpdateTimer(nullptr),
|
||||||
|
m_frame(nullptr),
|
||||||
|
m_capacityBar(nullptr),
|
||||||
|
m_lined(nullptr),
|
||||||
|
m_linkTargetLineEdit(nullptr)
|
||||||
{
|
{
|
||||||
dirSizeJob = 0L;
|
|
||||||
dirSizeUpdateTimer = 0L;
|
|
||||||
m_lined = 0;
|
|
||||||
m_capacityBar = 0;
|
|
||||||
m_linkTargetLineEdit = 0;
|
|
||||||
}
|
}
|
||||||
~KFilePropsPluginPrivate()
|
~KFilePropsPluginPrivate()
|
||||||
{
|
{
|
||||||
if ( dirSizeJob )
|
if (dirSizeJob) {
|
||||||
dirSizeJob->kill();
|
dirSizeJob->kill();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
KIO::DirectorySizeJob * dirSizeJob;
|
KIO::DirectorySizeJob * dirSizeJob;
|
||||||
QTimer *dirSizeUpdateTimer;
|
QTimer *dirSizeUpdateTimer;
|
||||||
|
@ -676,8 +674,9 @@ public:
|
||||||
QString oldName;
|
QString oldName;
|
||||||
};
|
};
|
||||||
|
|
||||||
KFilePropsPlugin::KFilePropsPlugin( KPropertiesDialog *_props )
|
KFilePropsPlugin::KFilePropsPlugin(KPropertiesDialog *props)
|
||||||
: KPropertiesDialogPlugin( _props ),d(new KFilePropsPluginPrivate)
|
: KPropertiesDialogPlugin(props),
|
||||||
|
d(new KFilePropsPluginPrivate())
|
||||||
{
|
{
|
||||||
d->bMultiple = (properties->items().count() > 1);
|
d->bMultiple = (properties->items().count() > 1);
|
||||||
d->bIconChanged = false;
|
d->bIconChanged = false;
|
||||||
|
@ -697,17 +696,20 @@ KFilePropsPlugin::KFilePropsPlugin( KPropertiesDialog *_props )
|
||||||
QString iconStr = KMimeType::iconNameForUrl(url, mode);
|
QString iconStr = KMimeType::iconNameForUrl(url, mode);
|
||||||
QString directory = properties->kurl().directory();
|
QString directory = properties->kurl().directory();
|
||||||
QString protocol = properties->kurl().protocol();
|
QString protocol = properties->kurl().protocol();
|
||||||
d->bKDesktopMode = protocol == QLatin1String("desktop") ||
|
d->bKDesktopMode = (
|
||||||
properties->currentDir().protocol() == QLatin1String("desktop");
|
protocol == QLatin1String("desktop") ||
|
||||||
|
properties->currentDir().protocol() == QLatin1String("desktop")
|
||||||
|
);
|
||||||
QString mimeComment = item.mimeComment();
|
QString mimeComment = item.mimeComment();
|
||||||
d->mimeType = item.mimetype();
|
d->mimeType = item.mimetype();
|
||||||
KIO::filesize_t totalSize = item.size();
|
KIO::filesize_t totalSize = item.size();
|
||||||
QString magicMimeComment;
|
QString magicMimeComment;
|
||||||
if (isLocal) {
|
if (isLocal) {
|
||||||
KMimeType::Ptr magicMimeType = KMimeType::findByFileContent(url.toLocalFile());
|
KMimeType::Ptr magicMimeType = KMimeType::findByFileContent(url.toLocalFile());
|
||||||
if ( magicMimeType->name() != KMimeType::defaultMimeType() )
|
if (magicMimeType->name() != KMimeType::defaultMimeType()) {
|
||||||
magicMimeComment = magicMimeType->comment();
|
magicMimeComment = magicMimeType->comment();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Those things only apply to 'single file' mode
|
// Those things only apply to 'single file' mode
|
||||||
QString filename;
|
QString filename;
|
||||||
|
@ -715,8 +717,8 @@ KFilePropsPlugin::KFilePropsPlugin( KPropertiesDialog *_props )
|
||||||
d->m_bFromTemplate = false;
|
d->m_bFromTemplate = false;
|
||||||
|
|
||||||
// And those only to 'multiple' mode
|
// And those only to 'multiple' mode
|
||||||
uint iDirCount = hasDirs ? 1 : 0;
|
uint iDirCount = (hasDirs ? 1 : 0);
|
||||||
uint iFileCount = 1-iDirCount;
|
uint iFileCount = (iDirCount - 1);
|
||||||
|
|
||||||
d->m_frame = new QFrame();
|
d->m_frame = new QFrame();
|
||||||
properties->addPage(d->m_frame, i18nc("@title:tab File properties", "&General"));
|
properties->addPage(d->m_frame, i18nc("@title:tab File properties", "&General"));
|
||||||
|
@ -732,16 +734,16 @@ KFilePropsPlugin::KFilePropsPlugin( KPropertiesDialog *_props )
|
||||||
vbl->addLayout(grid);
|
vbl->addLayout(grid);
|
||||||
int curRow = 0;
|
int curRow = 0;
|
||||||
|
|
||||||
if ( !d->bMultiple )
|
if (!d->bMultiple) {
|
||||||
{
|
|
||||||
QString path;
|
QString path;
|
||||||
if (!d->m_bFromTemplate) {
|
if (!d->m_bFromTemplate) {
|
||||||
isTrash = (properties->kurl().protocol().toLower() == "trash");
|
isTrash = (properties->kurl().protocol().toLower() == "trash");
|
||||||
// Extract the full name, but without file: for local files
|
// Extract the full name, but without file: for local files
|
||||||
if ( isReallyLocal )
|
if (isReallyLocal) {
|
||||||
path = properties->kurl().toLocalFile();
|
path = properties->kurl().toLocalFile();
|
||||||
else
|
} else {
|
||||||
path = properties->kurl().prettyUrl();
|
path = properties->kurl().prettyUrl();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
path = properties->currentDir().path(KUrl::AddTrailingSlash) + properties->defaultName();
|
path = properties->currentDir().path(KUrl::AddTrailingSlash) + properties->defaultName();
|
||||||
directory = properties->currentDir().prettyUrl();
|
directory = properties->currentDir().prettyUrl();
|
||||||
|
@ -773,56 +775,58 @@ KFilePropsPlugin::KFilePropsPlugin( KPropertiesDialog *_props )
|
||||||
}
|
}
|
||||||
|
|
||||||
d->oldName = filename;
|
d->oldName = filename;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
// Multiple items: see what they have in common
|
// Multiple items: see what they have in common
|
||||||
const KFileItemList items = properties->items();
|
const KFileItemList items = properties->items();
|
||||||
KFileItemList::const_iterator kit = items.begin();
|
KFileItemList::const_iterator kit = items.begin();
|
||||||
const KFileItemList::const_iterator kend = items.end();
|
const KFileItemList::const_iterator kend = items.end();
|
||||||
for ( ++kit /*no need to check the first one again*/ ; kit != kend; ++kit )
|
for ( ++kit /*no need to check the first one again*/ ; kit != kend; ++kit) {
|
||||||
{
|
|
||||||
const KUrl url = (*kit).url();
|
const KUrl url = (*kit).url();
|
||||||
kDebug(250) << "KFilePropsPlugin::KFilePropsPlugin " << url.prettyUrl();
|
kDebug(250) << "KFilePropsPlugin::KFilePropsPlugin " << url.prettyUrl();
|
||||||
// The list of things we check here should match the variables defined
|
// The list of things we check here should match the variables defined
|
||||||
// at the beginning of this method.
|
// at the beginning of this method.
|
||||||
if ( url.isLocalFile() != isLocal )
|
if (url.isLocalFile() != isLocal) {
|
||||||
isLocal = false; // not all local
|
isLocal = false; // not all local
|
||||||
if ( bDesktopFile && (*kit).isDesktopFile() != bDesktopFile )
|
}
|
||||||
|
if (bDesktopFile && (*kit).isDesktopFile() != bDesktopFile) {
|
||||||
bDesktopFile = false; // not all desktop files
|
bDesktopFile = false; // not all desktop files
|
||||||
if ( (*kit).mode() != mode )
|
}
|
||||||
|
if ((*kit).mode() != mode) {
|
||||||
mode = (mode_t)0;
|
mode = (mode_t)0;
|
||||||
if ( KMimeType::iconNameForUrl(url, mode) != iconStr )
|
}
|
||||||
|
if (KMimeType::iconNameForUrl(url, mode) != iconStr) {
|
||||||
iconStr = "document-multiple";
|
iconStr = "document-multiple";
|
||||||
if ( url.directory() != directory )
|
}
|
||||||
|
if (url.directory() != directory) {
|
||||||
directory.clear();
|
directory.clear();
|
||||||
if ( url.protocol() != protocol )
|
}
|
||||||
|
if (url.protocol() != protocol) {
|
||||||
protocol.clear();
|
protocol.clear();
|
||||||
if ( !mimeComment.isNull() && (*kit).mimeComment() != mimeComment )
|
}
|
||||||
|
if (!mimeComment.isNull() && (*kit).mimeComment() != mimeComment) {
|
||||||
mimeComment.clear();
|
mimeComment.clear();
|
||||||
|
}
|
||||||
if (isLocal && !magicMimeComment.isNull()) {
|
if (isLocal && !magicMimeComment.isNull()) {
|
||||||
KMimeType::Ptr magicMimeType = KMimeType::findByFileContent(url.toLocalFile());
|
KMimeType::Ptr magicMimeType = KMimeType::findByFileContent(url.toLocalFile());
|
||||||
if ( magicMimeType->comment() != magicMimeComment )
|
if (magicMimeType->comment() != magicMimeComment) {
|
||||||
magicMimeComment.clear();
|
magicMimeComment.clear();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( isLocal && url.path() == QLatin1String("/") )
|
if (isLocal && url.path() == QLatin1String("/")) {
|
||||||
hasRoot = true;
|
hasRoot = true;
|
||||||
if ( (*kit).isDir() && !(*kit).isLink() )
|
}
|
||||||
{
|
if ((*kit).isDir() && !(*kit).isLink()) {
|
||||||
iDirCount++;
|
iDirCount++;
|
||||||
hasDirs = true;
|
hasDirs = true;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
iFileCount++;
|
iFileCount++;
|
||||||
totalSize += (*kit).size();
|
totalSize += (*kit).size();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isReallyLocal && !protocol.isEmpty())
|
if (!isReallyLocal && !protocol.isEmpty()) {
|
||||||
{
|
|
||||||
directory += ' ';
|
directory += ' ';
|
||||||
directory += '(';
|
directory += '(';
|
||||||
directory += protocol;
|
directory += protocol;
|
||||||
|
@ -843,17 +847,20 @@ KFilePropsPlugin::KFilePropsPlugin( KPropertiesDialog *_props )
|
||||||
KDesktopFile config(url.toLocalFile());
|
KDesktopFile config(url.toLocalFile());
|
||||||
KConfigGroup group = config.desktopGroup();
|
KConfigGroup group = config.desktopGroup();
|
||||||
iconStr = group.readEntry("Icon");
|
iconStr = group.readEntry("Icon");
|
||||||
if ( config.hasDeviceType() )
|
if (config.hasDeviceType()) {
|
||||||
iconButton->setIconType( KIconLoader::Desktop, KIconLoader::Device);
|
iconButton->setIconType( KIconLoader::Desktop, KIconLoader::Device);
|
||||||
else
|
} else {
|
||||||
iconButton->setIconType( KIconLoader::Desktop, KIconLoader::Application);
|
iconButton->setIconType( KIconLoader::Desktop, KIconLoader::Application);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
iconButton->setIconType(KIconLoader::Desktop, KIconLoader::Place);
|
iconButton->setIconType(KIconLoader::Desktop, KIconLoader::Place);
|
||||||
}
|
}
|
||||||
iconButton->setIcon(iconStr);
|
iconButton->setIcon(iconStr);
|
||||||
d->iconArea = iconButton;
|
d->iconArea = iconButton;
|
||||||
connect(iconButton, SIGNAL(iconChanged(QString)),
|
connect(
|
||||||
this, SLOT(slotIconChanged()));
|
iconButton, SIGNAL(iconChanged(QString)),
|
||||||
|
this, SLOT(slotIconChanged())
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
QLabel *iconLabel = new QLabel(d->m_frame);
|
QLabel *iconLabel = new QLabel(d->m_frame);
|
||||||
int bsize = 66 + 2 * iconLabel->style()->pixelMetric(QStyle::PM_ButtonMargin);
|
int bsize = 66 + 2 * iconLabel->style()->pixelMetric(QStyle::PM_ButtonMargin);
|
||||||
|
@ -863,16 +870,15 @@ KFilePropsPlugin::KFilePropsPlugin( KPropertiesDialog *_props )
|
||||||
}
|
}
|
||||||
grid->addWidget(d->iconArea, curRow, 0, Qt::AlignLeft);
|
grid->addWidget(d->iconArea, curRow, 0, Qt::AlignLeft);
|
||||||
|
|
||||||
if (d->bMultiple || isTrash || hasRoot)
|
if (d->bMultiple || isTrash || hasRoot) {
|
||||||
{
|
|
||||||
QLabel *lab = new QLabel(d->m_frame);
|
QLabel *lab = new QLabel(d->m_frame);
|
||||||
if ( d->bMultiple )
|
if (d->bMultiple) {
|
||||||
lab->setText(KIO::itemsSummaryString(iFileCount + iDirCount, iFileCount, iDirCount, 0, false));
|
lab->setText(KIO::itemsSummaryString(iFileCount + iDirCount, iFileCount, iDirCount, 0, false));
|
||||||
else
|
} else {
|
||||||
lab->setText(filename);
|
lab->setText(filename);
|
||||||
|
}
|
||||||
d->nameArea = lab;
|
d->nameArea = lab;
|
||||||
} else
|
} else {
|
||||||
{
|
|
||||||
d->m_lined = new KLineEdit(d->m_frame);
|
d->m_lined = new KLineEdit(d->m_frame);
|
||||||
d->m_lined->setText(filename);
|
d->m_lined->setText(filename);
|
||||||
d->nameArea = d->m_lined;
|
d->nameArea = d->m_lined;
|
||||||
|
@ -884,17 +890,19 @@ KFilePropsPlugin::KFilePropsPlugin( KPropertiesDialog *_props )
|
||||||
|
|
||||||
// Enhanced rename: Don't highlight the file extension.
|
// Enhanced rename: Don't highlight the file extension.
|
||||||
QString extension = KMimeType::extractKnownExtension(filename);
|
QString extension = KMimeType::extractKnownExtension(filename);
|
||||||
if ( !extension.isEmpty() )
|
if (!extension.isEmpty()) {
|
||||||
d->m_lined->setSelection(0, filename.length() - extension.length() - 1);
|
d->m_lined->setSelection(0, filename.length() - extension.length() - 1);
|
||||||
else
|
} else {
|
||||||
{
|
|
||||||
int lastDot = filename.lastIndexOf('.');
|
int lastDot = filename.lastIndexOf('.');
|
||||||
if (lastDot > 0)
|
if (lastDot > 0) {
|
||||||
d->m_lined->setSelection(0, lastDot);
|
d->m_lined->setSelection(0, lastDot);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
connect( d->m_lined, SIGNAL(textChanged(QString)),
|
connect(
|
||||||
this, SLOT(nameFileChanged(QString)) );
|
d->m_lined, SIGNAL(textChanged(QString)),
|
||||||
|
this, SLOT(nameFileChanged(QString))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
grid->addWidget(d->nameArea, curRow++, 2);
|
grid->addWidget(d->nameArea, curRow++, 2);
|
||||||
|
@ -903,7 +911,7 @@ KFilePropsPlugin::KFilePropsPlugin( KPropertiesDialog *_props )
|
||||||
grid->addWidget(sep, curRow, 0, 1, 3);
|
grid->addWidget(sep, curRow, 0, 1, 3);
|
||||||
++curRow;
|
++curRow;
|
||||||
|
|
||||||
QLabel *l;
|
QLabel *l = nullptr;
|
||||||
if (!mimeComment.isEmpty() && !isTrash) {
|
if (!mimeComment.isEmpty() && !isTrash) {
|
||||||
l = new QLabel(i18n("Type:"), d->m_frame );
|
l = new QLabel(i18n("Type:"), d->m_frame );
|
||||||
grid->addWidget(l, curRow, 0, Qt::AlignRight | Qt::AlignTop);
|
grid->addWidget(l, curRow, 0, Qt::AlignRight | Qt::AlignTop);
|
||||||
|
@ -917,16 +925,16 @@ KFilePropsPlugin::KFilePropsPlugin( KPropertiesDialog *_props )
|
||||||
button->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); // Minimum still makes the button grow to the entire layout width
|
button->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); // Minimum still makes the button grow to the entire layout width
|
||||||
button->setIcon( KIcon(QString::fromLatin1("configure")) );
|
button->setIcon( KIcon(QString::fromLatin1("configure")) );
|
||||||
|
|
||||||
if ( d->mimeType == KMimeType::defaultMimeType() )
|
if (d->mimeType == KMimeType::defaultMimeType()) {
|
||||||
button->setText(i18n("Create New File Type"));
|
button->setText(i18n("Create New File Type"));
|
||||||
else
|
} else {
|
||||||
button->setText(i18n("File Type Options"));
|
button->setText(i18n("File Type Options"));
|
||||||
|
}
|
||||||
|
|
||||||
connect(button, SIGNAL(clicked()), SLOT(slotEditFileType()));
|
connect(button, SIGNAL(clicked()), SLOT(slotEditFileType()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !magicMimeComment.isEmpty() && magicMimeComment != mimeComment )
|
if (!magicMimeComment.isEmpty() && magicMimeComment != mimeComment) {
|
||||||
{
|
|
||||||
l = new QLabel(i18n("Contents:"), d->m_frame);
|
l = new QLabel(i18n("Contents:"), d->m_frame);
|
||||||
grid->addWidget(l, curRow, 0, Qt::AlignRight);
|
grid->addWidget(l, curRow, 0, Qt::AlignRight);
|
||||||
|
|
||||||
|
@ -934,8 +942,7 @@ KFilePropsPlugin::KFilePropsPlugin( KPropertiesDialog *_props )
|
||||||
grid->addWidget(l, curRow++, 2);
|
grid->addWidget(l, curRow++, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !directory.isEmpty() )
|
if (!directory.isEmpty()) {
|
||||||
{
|
|
||||||
l = new QLabel(i18n("Location:"), d->m_frame);
|
l = new QLabel(i18n("Location:"), d->m_frame);
|
||||||
grid->addWidget(l, curRow, 0, Qt::AlignRight);
|
grid->addWidget(l, curRow, 0, Qt::AlignRight);
|
||||||
|
|
||||||
|
@ -944,8 +951,9 @@ KFilePropsPlugin::KFilePropsPlugin( KPropertiesDialog *_props )
|
||||||
l->setLayoutDirection(Qt::LeftToRight);
|
l->setLayoutDirection(Qt::LeftToRight);
|
||||||
// but if we are in RTL mode, align the text to the right
|
// but if we are in RTL mode, align the text to the right
|
||||||
// otherwise the text is on the wrong side of the dialog
|
// otherwise the text is on the wrong side of the dialog
|
||||||
if (properties->layoutDirection() == Qt::RightToLeft)
|
if (properties->layoutDirection() == Qt::RightToLeft) {
|
||||||
l->setAlignment(Qt::AlignRight);
|
l->setAlignment(Qt::AlignRight);
|
||||||
|
}
|
||||||
l->setTextInteractionFlags(Qt::TextSelectableByMouse|Qt::TextSelectableByKeyboard);
|
l->setTextInteractionFlags(Qt::TextSelectableByMouse|Qt::TextSelectableByKeyboard);
|
||||||
grid->addWidget(l, curRow++, 2);
|
grid->addWidget(l, curRow++, 2);
|
||||||
}
|
}
|
||||||
|
@ -956,15 +964,14 @@ KFilePropsPlugin::KFilePropsPlugin( KPropertiesDialog *_props )
|
||||||
d->m_sizeLabel = new QLabel(d->m_frame);
|
d->m_sizeLabel = new QLabel(d->m_frame);
|
||||||
grid->addWidget(d->m_sizeLabel, curRow++, 2);
|
grid->addWidget(d->m_sizeLabel, curRow++, 2);
|
||||||
|
|
||||||
if ( !hasDirs ) // Only files [and symlinks]
|
if (!hasDirs) {
|
||||||
{
|
// Only files [and symlinks]
|
||||||
d->m_sizeLabel->setText(QString::fromLatin1("%1 (%2)").arg(KIO::convertSize(totalSize))
|
d->m_sizeLabel->setText(QString::fromLatin1("%1 (%2)").arg(KIO::convertSize(totalSize))
|
||||||
.arg(KGlobal::locale()->formatNumber(totalSize, 0)));
|
.arg(KGlobal::locale()->formatNumber(totalSize, 0)));
|
||||||
d->m_sizeDetermineButton = 0L;
|
d->m_sizeDetermineButton = 0L;
|
||||||
d->m_sizeStopButton = 0L;
|
d->m_sizeStopButton = 0L;
|
||||||
}
|
} else {
|
||||||
else // Directory
|
// Directory
|
||||||
{
|
|
||||||
QHBoxLayout* sizelay = new QHBoxLayout();
|
QHBoxLayout* sizelay = new QHBoxLayout();
|
||||||
grid->addLayout(sizelay, curRow++, 2);
|
grid->addLayout(sizelay, curRow++, 2);
|
||||||
|
|
||||||
|
@ -978,14 +985,13 @@ KFilePropsPlugin::KFilePropsPlugin( KPropertiesDialog *_props )
|
||||||
sizelay->addStretch(10); // so that the buttons don't grow horizontally
|
sizelay->addStretch(10); // so that the buttons don't grow horizontally
|
||||||
|
|
||||||
// auto-launch for local dirs only, and not for '/'
|
// auto-launch for local dirs only, and not for '/'
|
||||||
if ( isLocal && !hasRoot )
|
if (isLocal && !hasRoot) {
|
||||||
{
|
|
||||||
d->m_sizeDetermineButton->setText(i18n("Refresh"));
|
d->m_sizeDetermineButton->setText(i18n("Refresh"));
|
||||||
slotSizeDetermine();
|
slotSizeDetermine();
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
d->m_sizeStopButton->setEnabled(false);
|
d->m_sizeStopButton->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!d->bMultiple && item.isLink()) {
|
if (!d->bMultiple && item.isLink()) {
|
||||||
l = new QLabel(i18n("Points to:"), d->m_frame);
|
l = new QLabel(i18n("Points to:"), d->m_frame);
|
||||||
|
@ -996,11 +1002,10 @@ KFilePropsPlugin::KFilePropsPlugin( KPropertiesDialog *_props )
|
||||||
connect(d->m_linkTargetLineEdit, SIGNAL(textChanged(QString)), this, SLOT(setDirty()));
|
connect(d->m_linkTargetLineEdit, SIGNAL(textChanged(QString)), this, SLOT(setDirty()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!d->bMultiple) // Dates for multiple don't make much sense...
|
if (!d->bMultiple) {
|
||||||
{
|
// Dates for multiple don't make much sense...
|
||||||
KDateTime dt = item.time(KFileItem::CreationTime);
|
KDateTime dt = item.time(KFileItem::CreationTime);
|
||||||
if ( !dt.isNull() )
|
if (!dt.isNull()) {
|
||||||
{
|
|
||||||
l = new QLabel(i18n("Created:"), d->m_frame);
|
l = new QLabel(i18n("Created:"), d->m_frame);
|
||||||
grid->addWidget(l, curRow, 0, Qt::AlignRight);
|
grid->addWidget(l, curRow, 0, Qt::AlignRight);
|
||||||
|
|
||||||
|
@ -1009,8 +1014,7 @@ KFilePropsPlugin::KFilePropsPlugin( KPropertiesDialog *_props )
|
||||||
}
|
}
|
||||||
|
|
||||||
dt = item.time(KFileItem::ModificationTime);
|
dt = item.time(KFileItem::ModificationTime);
|
||||||
if ( !dt.isNull() )
|
if (!dt.isNull()) {
|
||||||
{
|
|
||||||
l = new QLabel(i18n("Modified:"), d->m_frame);
|
l = new QLabel(i18n("Modified:"), d->m_frame);
|
||||||
grid->addWidget(l, curRow, 0, Qt::AlignRight);
|
grid->addWidget(l, curRow, 0, Qt::AlignRight);
|
||||||
|
|
||||||
|
@ -1019,8 +1023,7 @@ KFilePropsPlugin::KFilePropsPlugin( KPropertiesDialog *_props )
|
||||||
}
|
}
|
||||||
|
|
||||||
dt = item.time(KFileItem::AccessTime);
|
dt = item.time(KFileItem::AccessTime);
|
||||||
if ( !dt.isNull() )
|
if (!dt.isNull()) {
|
||||||
{
|
|
||||||
l = new QLabel(i18n("Accessed:"), d->m_frame);
|
l = new QLabel(i18n("Accessed:"), d->m_frame);
|
||||||
grid->addWidget(l, curRow, 0, Qt::AlignRight);
|
grid->addWidget(l, curRow, 0, Qt::AlignRight);
|
||||||
|
|
||||||
|
@ -1029,19 +1032,17 @@ KFilePropsPlugin::KFilePropsPlugin( KPropertiesDialog *_props )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isLocal && hasDirs ) // only for directories
|
if (isLocal && hasDirs) {
|
||||||
{
|
// only for directories
|
||||||
|
|
||||||
KMountPoint::Ptr mp = KMountPoint::currentMountPoints().findByPath(url.toLocalFile());
|
KMountPoint::Ptr mp = KMountPoint::currentMountPoints().findByPath(url.toLocalFile());
|
||||||
if (mp) {
|
if (mp) {
|
||||||
KDiskFreeSpaceInfo info = KDiskFreeSpaceInfo::freeSpaceInfo(mp->mountPoint());
|
KDiskFreeSpaceInfo info = KDiskFreeSpaceInfo::freeSpaceInfo(mp->mountPoint());
|
||||||
if(info.size() != 0 )
|
if (info.size() != 0) {
|
||||||
{
|
|
||||||
sep = new KSeparator(Qt::Horizontal, d->m_frame);
|
sep = new KSeparator(Qt::Horizontal, d->m_frame);
|
||||||
grid->addWidget(sep, curRow, 0, 1, 3);
|
grid->addWidget(sep, curRow, 0, 1, 3);
|
||||||
++curRow;
|
++curRow;
|
||||||
if (mp->mountPoint() != "/")
|
if (mp->mountPoint() != "/") {
|
||||||
{
|
|
||||||
l = new QLabel(i18n("Mounted on:"), d->m_frame);
|
l = new QLabel(i18n("Mounted on:"), d->m_frame);
|
||||||
grid->addWidget(l, curRow, 0, Qt::AlignRight);
|
grid->addWidget(l, curRow, 0, Qt::AlignRight);
|
||||||
|
|
||||||
|
@ -1084,11 +1085,9 @@ bool KFilePropsPlugin::enableIconButton() const
|
||||||
|
|
||||||
void KFilePropsPlugin::setFileNameReadOnly(bool ro)
|
void KFilePropsPlugin::setFileNameReadOnly(bool ro)
|
||||||
{
|
{
|
||||||
if ( d->m_lined && !d->m_bFromTemplate )
|
if (d->m_lined && !d->m_bFromTemplate) {
|
||||||
{
|
|
||||||
d->m_lined->setReadOnly(ro);
|
d->m_lined->setReadOnly(ro);
|
||||||
if (ro)
|
if (ro) {
|
||||||
{
|
|
||||||
// Don't put the initial focus on the line edit when it is ro
|
// Don't put the initial focus on the line edit when it is ro
|
||||||
properties->setButtonFocus(KDialog::Ok);
|
properties->setButtonFocus(KDialog::Ok);
|
||||||
}
|
}
|
||||||
|
@ -1100,10 +1099,11 @@ void KFilePropsPlugin::slotEditFileType()
|
||||||
QString mime;
|
QString mime;
|
||||||
if (d->mimeType == KMimeType::defaultMimeType()) {
|
if (d->mimeType == KMimeType::defaultMimeType()) {
|
||||||
const int pos = d->oldFileName.lastIndexOf('.');
|
const int pos = d->oldFileName.lastIndexOf('.');
|
||||||
if (pos != -1)
|
if (pos != -1) {
|
||||||
mime = '*' + d->oldFileName.mid(pos);
|
mime = '*' + d->oldFileName.mid(pos);
|
||||||
else
|
} else {
|
||||||
mime = '*';
|
mime = '*';
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
mime = d->mimeType;
|
mime = d->mimeType;
|
||||||
}
|
}
|
||||||
|
@ -1133,11 +1133,12 @@ void KFilePropsPlugin::determineRelativePath( const QString & path )
|
||||||
{
|
{
|
||||||
// now let's make it relative
|
// now let's make it relative
|
||||||
d->m_sRelativePath =KGlobal::dirs()->relativeLocation("xdgdata-apps", path);
|
d->m_sRelativePath =KGlobal::dirs()->relativeLocation("xdgdata-apps", path);
|
||||||
if (d->m_sRelativePath.startsWith('/'))
|
if (d->m_sRelativePath.startsWith('/')) {
|
||||||
d->m_sRelativePath.clear();
|
d->m_sRelativePath.clear();
|
||||||
else
|
} else {
|
||||||
d->m_sRelativePath = path;
|
d->m_sRelativePath = path;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void KFilePropsPlugin::slotFoundMountPoint(const QString &,
|
void KFilePropsPlugin::slotFoundMountPoint(const QString &,
|
||||||
quint64 kibSize,
|
quint64 kibSize,
|
||||||
|
@ -1148,7 +1149,8 @@ void KFilePropsPlugin::slotFoundMountPoint( const QString&,
|
||||||
i18nc("Available space out of total partition size (percent used)", "%1 free of %2 (%3% used)",
|
i18nc("Available space out of total partition size (percent used)", "%1 free of %2 (%3% used)",
|
||||||
KIO::convertSizeFromKiB(kibAvail),
|
KIO::convertSizeFromKiB(kibAvail),
|
||||||
KIO::convertSizeFromKiB(kibSize),
|
KIO::convertSizeFromKiB(kibSize),
|
||||||
100 - (int)(100.0 * kibAvail / kibSize) ));
|
100 - (int)(100.0 * kibAvail / kibSize))
|
||||||
|
);
|
||||||
|
|
||||||
d->m_capacityBar->setValue(100 - (int)(100.0 * kibAvail / kibSize));
|
d->m_capacityBar->setValue(100 - (int)(100.0 * kibAvail / kibSize));
|
||||||
}
|
}
|
||||||
|
@ -1163,15 +1165,15 @@ void KFilePropsPlugin::slotDirSizeUpdate()
|
||||||
KIO::convertSize(totalSize),
|
KIO::convertSize(totalSize),
|
||||||
totalSize,
|
totalSize,
|
||||||
i18np("1 file", "%1 files", totalFiles),
|
i18np("1 file", "%1 files", totalFiles),
|
||||||
i18np("1 sub-folder", "%1 sub-folders", totalSubdirs)));
|
i18np("1 sub-folder", "%1 sub-folders", totalSubdirs))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void KFilePropsPlugin::slotDirSizeFinished(KJob *job)
|
void KFilePropsPlugin::slotDirSizeFinished(KJob *job)
|
||||||
{
|
{
|
||||||
if (job->error())
|
if (job->error()) {
|
||||||
d->m_sizeLabel->setText( job->errorString());
|
d->m_sizeLabel->setText( job->errorString());
|
||||||
else
|
} else {
|
||||||
{
|
|
||||||
KIO::filesize_t totalSize = d->dirSizeJob->totalSize();
|
KIO::filesize_t totalSize = d->dirSizeJob->totalSize();
|
||||||
KIO::filesize_t totalFiles = d->dirSizeJob->totalFiles();
|
KIO::filesize_t totalFiles = d->dirSizeJob->totalFiles();
|
||||||
KIO::filesize_t totalSubdirs = d->dirSizeJob->totalSubdirs();
|
KIO::filesize_t totalSubdirs = d->dirSizeJob->totalSubdirs();
|
||||||
|
@ -1198,17 +1200,20 @@ void KFilePropsPlugin::slotSizeDetermine()
|
||||||
|
|
||||||
d->dirSizeJob = KIO::directorySize(properties->items());
|
d->dirSizeJob = KIO::directorySize(properties->items());
|
||||||
d->dirSizeUpdateTimer = new QTimer(this);
|
d->dirSizeUpdateTimer = new QTimer(this);
|
||||||
connect( d->dirSizeUpdateTimer, SIGNAL(timeout()),
|
connect(
|
||||||
SLOT(slotDirSizeUpdate()) );
|
d->dirSizeUpdateTimer, SIGNAL(timeout()),
|
||||||
|
this, SLOT(slotDirSizeUpdate())
|
||||||
|
);
|
||||||
d->dirSizeUpdateTimer->start(500);
|
d->dirSizeUpdateTimer->start(500);
|
||||||
connect( d->dirSizeJob, SIGNAL(result(KJob*)),
|
connect(
|
||||||
SLOT(slotDirSizeFinished(KJob*)) );
|
d->dirSizeJob, SIGNAL(result(KJob*)),
|
||||||
|
this, SLOT(slotDirSizeFinished(KJob*))
|
||||||
|
);
|
||||||
d->m_sizeStopButton->setEnabled(true);
|
d->m_sizeStopButton->setEnabled(true);
|
||||||
d->m_sizeDetermineButton->setEnabled(false);
|
d->m_sizeDetermineButton->setEnabled(false);
|
||||||
|
|
||||||
// also update the "Free disk space" display
|
// also update the "Free disk space" display
|
||||||
if ( d->m_capacityBar )
|
if (d->m_capacityBar) {
|
||||||
{
|
|
||||||
bool isLocal;
|
bool isLocal;
|
||||||
const KFileItem item = properties->item();
|
const KFileItem item = properties->item();
|
||||||
KUrl url = item.mostLocalUrl(isLocal);
|
KUrl url = item.mostLocalUrl(isLocal);
|
||||||
|
@ -1224,16 +1229,15 @@ void KFilePropsPlugin::slotSizeDetermine()
|
||||||
|
|
||||||
void KFilePropsPlugin::slotSizeStop()
|
void KFilePropsPlugin::slotSizeStop()
|
||||||
{
|
{
|
||||||
if ( d->dirSizeJob )
|
if (d->dirSizeJob) {
|
||||||
{
|
|
||||||
KIO::filesize_t totalSize = d->dirSizeJob->totalSize();
|
KIO::filesize_t totalSize = d->dirSizeJob->totalSize();
|
||||||
d->m_sizeLabel->setText(i18n("At least %1",
|
d->m_sizeLabel->setText(i18n("At least %1", KIO::convertSize(totalSize)));
|
||||||
KIO::convertSize(totalSize)));
|
|
||||||
d->dirSizeJob->kill();
|
d->dirSizeJob->kill();
|
||||||
d->dirSizeJob = 0;
|
d->dirSizeJob = 0;
|
||||||
}
|
}
|
||||||
if ( d->dirSizeUpdateTimer )
|
if (d->dirSizeUpdateTimer) {
|
||||||
d->dirSizeUpdateTimer->stop();
|
d->dirSizeUpdateTimer->stop();
|
||||||
|
}
|
||||||
|
|
||||||
d->m_sizeStopButton->setEnabled(false);
|
d->m_sizeStopButton->setEnabled(false);
|
||||||
d->m_sizeDetermineButton->setEnabled(true);
|
d->m_sizeDetermineButton->setEnabled(true);
|
||||||
|
@ -1244,26 +1248,26 @@ KFilePropsPlugin::~KFilePropsPlugin()
|
||||||
delete d;
|
delete d;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool KFilePropsPlugin::supports( const KFileItemList& /*_items*/ )
|
bool KFilePropsPlugin::supports(const KFileItemList &/*items*/)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void KFilePropsPlugin::applyChanges()
|
void KFilePropsPlugin::applyChanges()
|
||||||
{
|
{
|
||||||
if ( d->dirSizeJob )
|
if (d->dirSizeJob) {
|
||||||
slotSizeStop();
|
slotSizeStop();
|
||||||
|
}
|
||||||
|
|
||||||
kDebug(250) << "KFilePropsPlugin::applyChanges";
|
kDebug(250) << "KFilePropsPlugin::applyChanges";
|
||||||
|
|
||||||
if (qobject_cast<QLineEdit*>(d->nameArea))
|
if (qobject_cast<QLineEdit*>(d->nameArea)) {
|
||||||
{
|
|
||||||
QString n = ((QLineEdit *) d->nameArea)->text();
|
QString n = ((QLineEdit *) d->nameArea)->text();
|
||||||
// Remove trailing spaces (#4345)
|
// Remove trailing spaces (#4345)
|
||||||
while ( ! n.isEmpty() && n[n.length()-1].isSpace() )
|
while (!n.isEmpty() && n[n.length()-1].isSpace()) {
|
||||||
n.truncate(n.length() - 1);
|
n.truncate(n.length() - 1);
|
||||||
if ( n.isEmpty() )
|
}
|
||||||
{
|
if (n.isEmpty()) {
|
||||||
KMessageBox::sorry(properties, i18n("The new file name is empty."));
|
KMessageBox::sorry(properties, i18n("The new file name is empty."));
|
||||||
properties->abortApplying();
|
properties->abortApplying();
|
||||||
return;
|
return;
|
||||||
|
@ -1272,43 +1276,54 @@ void KFilePropsPlugin::applyChanges()
|
||||||
// Do we need to rename the file ?
|
// Do we need to rename the file ?
|
||||||
kDebug(250) << "oldname = " << d->oldName;
|
kDebug(250) << "oldname = " << d->oldName;
|
||||||
kDebug(250) << "newname = " << n;
|
kDebug(250) << "newname = " << n;
|
||||||
if ( d->oldName != n || d->m_bFromTemplate ) { // true for any from-template file
|
if (d->oldName != n || d->m_bFromTemplate) {
|
||||||
|
// true for any from-template file
|
||||||
KIO::Job * job = 0L;
|
KIO::Job * job = 0L;
|
||||||
KUrl oldurl = properties->kurl();
|
KUrl oldurl = properties->kurl();
|
||||||
|
|
||||||
QString newFileName = KIO::encodeFileName(n);
|
QString newFileName = KIO::encodeFileName(n);
|
||||||
if (d->bDesktopFile && !newFileName.endsWith(QLatin1String(".desktop")))
|
if (d->bDesktopFile && !newFileName.endsWith(QLatin1String(".desktop"))) {
|
||||||
newFileName += ".desktop";
|
newFileName += ".desktop";
|
||||||
|
}
|
||||||
|
|
||||||
// Tell properties. Warning, this changes the result of properties->kurl() !
|
// Tell properties. Warning, this changes the result of properties->kurl() !
|
||||||
properties->rename(newFileName);
|
properties->rename(newFileName);
|
||||||
|
|
||||||
// Update also relative path (for apps and mimetypes)
|
// Update also relative path (for apps and mimetypes)
|
||||||
if ( !d->m_sRelativePath.isEmpty() )
|
if (!d->m_sRelativePath.isEmpty()) {
|
||||||
determineRelativePath(properties->kurl().toLocalFile());
|
determineRelativePath(properties->kurl().toLocalFile());
|
||||||
|
}
|
||||||
|
|
||||||
kDebug(250) << "New URL = " << properties->kurl().url();
|
kDebug(250) << "New URL = " << properties->kurl().url();
|
||||||
kDebug(250) << "old = " << oldurl.url();
|
kDebug(250) << "old = " << oldurl.url();
|
||||||
|
|
||||||
// Don't remove the template !!
|
// Don't remove the template !!
|
||||||
if ( !d->m_bFromTemplate ) // (normal renaming)
|
if (!d->m_bFromTemplate) {
|
||||||
|
// (normal renaming)
|
||||||
job = KIO::moveAs(oldurl, properties->kurl());
|
job = KIO::moveAs(oldurl, properties->kurl());
|
||||||
else // Copying a template
|
} else {
|
||||||
|
// Copying a template
|
||||||
job = KIO::copyAs(oldurl, properties->kurl());
|
job = KIO::copyAs(oldurl, properties->kurl());
|
||||||
|
}
|
||||||
|
|
||||||
connect( job, SIGNAL(result(KJob*)),
|
connect(
|
||||||
SLOT(slotCopyFinished(KJob*)) );
|
job, SIGNAL(result(KJob*)),
|
||||||
connect( job, SIGNAL(renamed(KIO::Job*,KUrl,KUrl)),
|
this, SLOT(slotCopyFinished(KJob*))
|
||||||
SLOT(slotFileRenamed(KIO::Job*,KUrl,KUrl)) );
|
);
|
||||||
|
connect(
|
||||||
|
job, SIGNAL(renamed(KIO::Job*,KUrl,KUrl)),
|
||||||
|
this, SLOT(slotFileRenamed(KIO::Job*,KUrl,KUrl))
|
||||||
|
);
|
||||||
// wait for job
|
// wait for job
|
||||||
job->exec();
|
job->exec();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
properties->updateUrl(properties->kurl());
|
properties->updateUrl(properties->kurl());
|
||||||
// Update also relative path (for apps and mimetypes)
|
// Update also relative path (for apps and mimetypes)
|
||||||
if ( !d->m_sRelativePath.isEmpty() )
|
if (!d->m_sRelativePath.isEmpty()) {
|
||||||
determineRelativePath(properties->kurl().toLocalFile());
|
determineRelativePath(properties->kurl().toLocalFile());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// No job, keep going
|
// No job, keep going
|
||||||
slotCopyFinished(0L);
|
slotCopyFinished(0L);
|
||||||
|
@ -1317,12 +1332,10 @@ void KFilePropsPlugin::applyChanges()
|
||||||
void KFilePropsPlugin::slotCopyFinished(KJob *job)
|
void KFilePropsPlugin::slotCopyFinished(KJob *job)
|
||||||
{
|
{
|
||||||
kDebug(250) << "KFilePropsPlugin::slotCopyFinished";
|
kDebug(250) << "KFilePropsPlugin::slotCopyFinished";
|
||||||
if (job)
|
if (job) {
|
||||||
{
|
|
||||||
// allow apply() to return
|
// allow apply() to return
|
||||||
emit leaveModality();
|
emit leaveModality();
|
||||||
if ( job->error() )
|
if (job->error()) {
|
||||||
{
|
|
||||||
job->uiDelegate()->showErrorMessage();
|
job->uiDelegate()->showErrorMessage();
|
||||||
// Didn't work. Revert the URL to the old one
|
// Didn't work. Revert the URL to the old one
|
||||||
properties->updateUrl(static_cast<KIO::CopyJob*>(job)->srcUrls().first());
|
properties->updateUrl(static_cast<KIO::CopyJob*>(job)->srcUrls().first());
|
||||||
|
@ -1335,8 +1348,7 @@ void KFilePropsPlugin::slotCopyFinished( KJob * job )
|
||||||
Q_ASSERT(!properties->item().url().isEmpty());
|
Q_ASSERT(!properties->item().url().isEmpty());
|
||||||
|
|
||||||
// Save the file where we can -> usually in ~/.kde/...
|
// Save the file where we can -> usually in ~/.kde/...
|
||||||
if (d->bDesktopFile && !d->m_sRelativePath.isEmpty())
|
if (d->bDesktopFile && !d->m_sRelativePath.isEmpty()) {
|
||||||
{
|
|
||||||
kDebug(250) << "KFilePropsPlugin::slotCopyFinished " << d->m_sRelativePath;
|
kDebug(250) << "KFilePropsPlugin::slotCopyFinished " << d->m_sRelativePath;
|
||||||
KUrl newURL;
|
KUrl newURL;
|
||||||
newURL.setPath(KDesktopFile::locateLocal(d->m_sRelativePath));
|
newURL.setPath(KDesktopFile::locateLocal(d->m_sRelativePath));
|
||||||
|
@ -1396,8 +1408,9 @@ void KFilePropsPlugin::slotCopyFinished( KJob * job )
|
||||||
void KFilePropsPlugin::applyIconChanges()
|
void KFilePropsPlugin::applyIconChanges()
|
||||||
{
|
{
|
||||||
KIconButton *iconButton = qobject_cast<KIconButton*>(d->iconArea);
|
KIconButton *iconButton = qobject_cast<KIconButton*>(d->iconArea);
|
||||||
if ( !iconButton || !d->bIconChanged )
|
if (!iconButton || !d->bIconChanged) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
// handle icon changes - only local files (or pseudo-local) for now
|
// handle icon changes - only local files (or pseudo-local) for now
|
||||||
// TODO: Use KTempFile and KIO::file_copy with overwrite = true
|
// TODO: Use KTempFile and KIO::file_copy with overwrite = true
|
||||||
KUrl url = properties->kurl();
|
KUrl url = properties->kurl();
|
||||||
|
@ -1405,14 +1418,13 @@ void KFilePropsPlugin::applyIconChanges()
|
||||||
if (url.isLocalFile()) {
|
if (url.isLocalFile()) {
|
||||||
QString path;
|
QString path;
|
||||||
|
|
||||||
if (S_ISDIR(properties->item().mode()))
|
if (S_ISDIR(properties->item().mode())) {
|
||||||
{
|
|
||||||
path = url.toLocalFile(KUrl::AddTrailingSlash) + QString::fromLatin1(".directory");
|
path = url.toLocalFile(KUrl::AddTrailingSlash) + QString::fromLatin1(".directory");
|
||||||
// don't call updateUrl because the other tabs (i.e. permissions)
|
// don't call updateUrl because the other tabs (i.e. permissions)
|
||||||
// apply to the directory, not the .directory file.
|
// apply to the directory, not the .directory file.
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
path = url.toLocalFile();
|
path = url.toLocalFile();
|
||||||
|
}
|
||||||
|
|
||||||
// Get the default image
|
// Get the default image
|
||||||
QString str = KMimeType::findByUrl(url,
|
QString str = KMimeType::findByUrl(url,
|
||||||
|
|
|
@ -56,16 +56,14 @@ namespace KIO { class Job; }
|
||||||
class KIO_EXPORT KPropertiesDialog : public KPageDialog
|
class KIO_EXPORT KPropertiesDialog : public KPageDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine whether there are any property pages available for the
|
* Determine whether there are any property pages available for the
|
||||||
* given file items.
|
* given file items.
|
||||||
* @param _items the list of items to check.
|
* @param _items the list of items to check.
|
||||||
* @return true if there are any property pages, otherwise false.
|
* @return true if there are any property pages, otherwise false.
|
||||||
*/
|
*/
|
||||||
static bool canDisplay( const KFileItemList& _items );
|
static bool canDisplay(const KFileItemList &items);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Brings up a Properties dialog, as shown above.
|
* Brings up a Properties dialog, as shown above.
|
||||||
|
@ -78,8 +76,7 @@ public:
|
||||||
* @param parent is the parent of the dialog widget.
|
* @param parent is the parent of the dialog widget.
|
||||||
* @param name is the internal name.
|
* @param name is the internal name.
|
||||||
*/
|
*/
|
||||||
explicit KPropertiesDialog( const KFileItem& item,
|
explicit KPropertiesDialog(const KFileItem &item, QWidget* parent = nullptr);
|
||||||
QWidget* parent = 0 );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \overload
|
* \overload
|
||||||
|
@ -93,8 +90,7 @@ public:
|
||||||
* @param parent is the parent of the dialog widget.
|
* @param parent is the parent of the dialog widget.
|
||||||
* @param name is the internal name.
|
* @param name is the internal name.
|
||||||
*/
|
*/
|
||||||
explicit KPropertiesDialog( const KFileItemList& _items,
|
explicit KPropertiesDialog(const KFileItemList &items, QWidget *parent = nullptr);
|
||||||
QWidget *parent = 0 );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Brings up a Properties dialog. Convenience constructor for
|
* Brings up a Properties dialog. Convenience constructor for
|
||||||
|
@ -112,8 +108,7 @@ public:
|
||||||
* For local files with a known mimetype, simply create a KFileItem and pass
|
* For local files with a known mimetype, simply create a KFileItem and pass
|
||||||
* it to the other constructor.
|
* it to the other constructor.
|
||||||
*/
|
*/
|
||||||
explicit KPropertiesDialog( const KUrl& _url,
|
explicit KPropertiesDialog(const KUrl &url, QWidget *parent = nullptr);
|
||||||
QWidget* parent = 0 );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a properties dialog for a new .desktop file (whose name
|
* Creates a properties dialog for a new .desktop file (whose name
|
||||||
|
@ -127,9 +122,8 @@ public:
|
||||||
* @param parent is the parent of the dialog widget.
|
* @param parent is the parent of the dialog widget.
|
||||||
* @param name is the internal name.
|
* @param name is the internal name.
|
||||||
*/
|
*/
|
||||||
KPropertiesDialog( const KUrl& _tempUrl, const KUrl& _currentDir,
|
KPropertiesDialog(const KUrl &tempUrl, const KUrl ¤tDir,
|
||||||
const QString& _defaultName,
|
const QString &defaultName, QWidget *parent = nullptr);
|
||||||
QWidget* parent = 0 );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an empty properties dialog (for applications that want use
|
* Creates an empty properties dialog (for applications that want use
|
||||||
|
@ -140,8 +134,7 @@ public:
|
||||||
* @param name is the internal name.
|
* @param name is the internal name.
|
||||||
* @param modal tells the dialog whether it should be modal.
|
* @param modal tells the dialog whether it should be modal.
|
||||||
*/
|
*/
|
||||||
explicit KPropertiesDialog(const QString& title,
|
explicit KPropertiesDialog(const QString &title, QWidget *parent = nullptr);
|
||||||
QWidget* parent = 0);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cleans up the properties dialog and frees any associated resources,
|
* Cleans up the properties dialog and frees any associated resources,
|
||||||
|
@ -153,24 +146,18 @@ public:
|
||||||
/**
|
/**
|
||||||
* Immediately displays a Properties dialog using constructor with
|
* Immediately displays a Properties dialog using constructor with
|
||||||
* the same parameters.
|
* the same parameters.
|
||||||
* On MS Windows, if @p item points to a local file, native (non modal) property
|
|
||||||
* dialog is displayed (@p parent and @p modal are ignored in this case).
|
|
||||||
*
|
*
|
||||||
* @return true on successful dialog displaying (can be false on win32).
|
* @return true on successful dialog displaying.
|
||||||
*/
|
*/
|
||||||
static bool showDialog(const KFileItem& item, QWidget* parent = 0,
|
static bool showDialog(const KFileItem &item, QWidget *parent = nullptr, bool modal = true);
|
||||||
bool modal = true);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Immediately displays a Properties dialog using constructor with
|
* Immediately displays a Properties dialog using constructor with
|
||||||
* the same parameters.
|
* the same parameters.
|
||||||
* On MS Windows, if @p _url points to a local file, native (non modal) property
|
|
||||||
* dialog is displayed (@p parent and @p modal are ignored in this case).
|
|
||||||
*
|
*
|
||||||
* @return true on successful dialog displaying (can be false on win32).
|
* @return true on successful dialog displaying.
|
||||||
*/
|
*/
|
||||||
static bool showDialog(const KUrl& _url, QWidget* parent = 0,
|
static bool showDialog(const KUrl &url, QWidget *parent = nullptr, bool modal = true);
|
||||||
bool modal = true);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Immediately displays a Properties dialog using constructor with
|
* Immediately displays a Properties dialog using constructor with
|
||||||
|
@ -181,8 +168,7 @@ public:
|
||||||
*
|
*
|
||||||
* @return true on successful dialog displaying (can be false on win32).
|
* @return true on successful dialog displaying (can be false on win32).
|
||||||
*/
|
*/
|
||||||
static bool showDialog(const KFileItemList& _items, QWidget* parent = 0,
|
static bool showDialog(const KFileItemList &items, QWidget *parent = nullptr, bool modal = true);
|
||||||
bool modal = true);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a "3rd party" properties plugin to the dialog. Useful
|
* Adds a "3rd party" properties plugin to the dialog. Useful
|
||||||
|
@ -245,7 +231,7 @@ public:
|
||||||
* Can only be called if the dialog applies to a single file or URL.
|
* Can only be called if the dialog applies to a single file or URL.
|
||||||
* @param _newUrl the new URL
|
* @param _newUrl the new URL
|
||||||
*/
|
*/
|
||||||
void updateUrl( const KUrl& _newUrl );
|
void updateUrl(const KUrl &newUrl);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Renames the item to the specified name. This can only be called if
|
* Renames the item to the specified name. This can only be called if
|
||||||
|
@ -253,7 +239,7 @@ public:
|
||||||
* @param _name new filename, encoded.
|
* @param _name new filename, encoded.
|
||||||
* \see FilePropsDialogPlugin::applyChanges
|
* \see FilePropsDialogPlugin::applyChanges
|
||||||
*/
|
*/
|
||||||
void rename( const QString& _name );
|
void rename(const QString &name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* To abort applying changes.
|
* To abort applying changes.
|
||||||
|
@ -322,6 +308,7 @@ Q_SIGNALS:
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void leaveModality();
|
void leaveModality();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class KPropertiesDialogPrivate;
|
class KPropertiesDialogPrivate;
|
||||||
KPropertiesDialogPrivate* const d;
|
KPropertiesDialogPrivate* const d;
|
||||||
|
@ -352,7 +339,7 @@ public:
|
||||||
* To insert tabs into the properties dialog, use the add methods provided by
|
* To insert tabs into the properties dialog, use the add methods provided by
|
||||||
* KPageDialog (the properties dialog is a KPageDialog).
|
* KPageDialog (the properties dialog is a KPageDialog).
|
||||||
*/
|
*/
|
||||||
KPropertiesDialogPlugin( KPropertiesDialog *_props );
|
KPropertiesDialogPlugin( KPropertiesDialog *props);
|
||||||
virtual ~KPropertiesDialogPlugin();
|
virtual ~KPropertiesDialogPlugin();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -392,6 +379,4 @@ private:
|
||||||
KPropertiesDialogPluginPrivate* const d;
|
KPropertiesDialogPluginPrivate* const d;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#endif // KPROPERTIESDIALOG_H
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
||||||
KFilePropsPlugin( KPropertiesDialog *_props );
|
KFilePropsPlugin(KPropertiesDialog *props);
|
||||||
virtual ~KFilePropsPlugin();
|
virtual ~KFilePropsPlugin();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -62,7 +62,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* Tests whether the files specified by _items need a 'General' plugin.
|
* Tests whether the files specified by _items need a 'General' plugin.
|
||||||
*/
|
*/
|
||||||
static bool supports( const KFileItemList& _items );
|
static bool supports(const KFileItemList &items);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called after all plugins applied their changes
|
* Called after all plugins applied their changes
|
||||||
|
@ -84,6 +84,7 @@ protected Q_SLOTS:
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void leaveModality();
|
void leaveModality();
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void nameFileChanged(const QString &text);
|
void nameFileChanged(const QString &text);
|
||||||
void slotIconChanged();
|
void slotIconChanged();
|
||||||
|
@ -123,7 +124,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
||||||
KFilePermissionsPropsPlugin( KPropertiesDialog *_props );
|
KFilePermissionsPropsPlugin(KPropertiesDialog *props);
|
||||||
virtual ~KFilePermissionsPropsPlugin();
|
virtual ~KFilePermissionsPropsPlugin();
|
||||||
|
|
||||||
virtual void applyChanges();
|
virtual void applyChanges();
|
||||||
|
@ -131,10 +132,9 @@ public:
|
||||||
/**
|
/**
|
||||||
* Tests whether the file specified by _items needs a 'Permissions' plugin.
|
* Tests whether the file specified by _items needs a 'Permissions' plugin.
|
||||||
*/
|
*/
|
||||||
static bool supports( const KFileItemList& _items );
|
static bool supports(const KFileItemList &items);
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
|
|
||||||
void slotChmodResult(KJob *);
|
void slotChmodResult(KJob *);
|
||||||
void slotShowAdvancedPermissions();
|
void slotShowAdvancedPermissions();
|
||||||
|
|
||||||
|
@ -178,12 +178,12 @@ public:
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
||||||
KUrlPropsPlugin( KPropertiesDialog *_props );
|
KUrlPropsPlugin(KPropertiesDialog *props);
|
||||||
virtual ~KUrlPropsPlugin();
|
virtual ~KUrlPropsPlugin();
|
||||||
|
|
||||||
virtual void applyChanges();
|
virtual void applyChanges();
|
||||||
|
|
||||||
static bool supports( const KFileItemList& _items );
|
static bool supports(const KFileItemList &items);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class KUrlPropsPluginPrivate;
|
class KUrlPropsPluginPrivate;
|
||||||
|
@ -199,12 +199,12 @@ class KDevicePropsPlugin : public KPropertiesDialogPlugin
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
KDevicePropsPlugin( KPropertiesDialog *_props );
|
KDevicePropsPlugin(KPropertiesDialog *props);
|
||||||
virtual ~KDevicePropsPlugin();
|
virtual ~KDevicePropsPlugin();
|
||||||
|
|
||||||
virtual void applyChanges();
|
virtual void applyChanges();
|
||||||
|
|
||||||
static bool supports( const KFileItemList& _items );
|
static bool supports(const KFileItemList &items);
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void slotActivated(int);
|
void slotActivated(int);
|
||||||
|
@ -235,12 +235,12 @@ public:
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
||||||
KDesktopPropsPlugin( KPropertiesDialog *_props );
|
KDesktopPropsPlugin( KPropertiesDialog *props);
|
||||||
virtual ~KDesktopPropsPlugin();
|
virtual ~KDesktopPropsPlugin();
|
||||||
|
|
||||||
virtual void applyChanges();
|
virtual void applyChanges();
|
||||||
|
|
||||||
static bool supports( const KFileItemList& _items );
|
static bool supports(const KFileItemList &items);
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void slotAddFiletype();
|
void slotAddFiletype();
|
||||||
|
|
Loading…
Add table
Reference in a new issue