[kde-doc-english] KDE/kdelibs/kio/kfile
David Faure
faure at kde.org
Tue Feb 10 23:35:43 CET 2009
SVN commit 924500 by dfaure:
GUI: make symlink target editable
FEATURE: 131495
M +16 -3 kpropertiesdialog.cpp
--- trunk/KDE/kdelibs/kio/kfile/kpropertiesdialog.cpp #924499:924500
@@ -100,6 +100,7 @@
#include <kio/directorysizejob.h>
#include <kio/renamedialog.h>
#include <kio/netaccess.h>
+#include <kio/jobuidelegate.h>
#include <kfiledialog.h>
#include <kmimetype.h>
#include <kmountpoint.h>
@@ -688,6 +689,7 @@
dirSizeUpdateTimer = 0L;
m_lined = 0;
m_capacityBar = 0;
+ m_linkTargetLineEdit = 0;
}
~KFilePropsPluginPrivate()
{
@@ -713,6 +715,7 @@
QLabel *m_sizeLabel;
QPushButton *m_sizeDetermineButton;
QPushButton *m_sizeStopButton;
+ KLineEdit* m_linkTargetLineEdit;
QString m_sRelativePath;
bool m_bFromTemplate;
@@ -1046,9 +1049,8 @@
l = new QLabel(i18n("Points to:"), d->m_frame );
grid->addWidget(l, curRow, 0, Qt::AlignRight);
- l = new KSqueezedTextLabel(item.linkDest(), d->m_frame );
- l->setTextInteractionFlags(Qt::TextSelectableByMouse|Qt::TextSelectableByKeyboard);
- grid->addWidget(l, curRow++, 2);
+ d->m_linkTargetLineEdit = new KLineEdit(item.linkDest(), d->m_frame );
+ grid->addWidget(d->m_linkTargetLineEdit, curRow++, 2);
}
if (!d->bMultiple) // Dates for multiple don't make much sense...
@@ -1401,6 +1403,17 @@
cg.writeEntry( "Name", nameStr, KConfigGroup::Persistent|KConfigGroup::Localized);
}
}
+
+ if (d->m_linkTargetLineEdit && !d->bMultiple) {
+ const KFileItem item = properties->item();
+ const QString newTarget = d->m_linkTargetLineEdit->text();
+ if (newTarget != item.linkDest()) {
+ kDebug(250) << "Updating target of symlink to" << newTarget;
+ KIO::Job* job = KIO::symlink(newTarget, item.url(), KIO::Overwrite);
+ job->ui()->setAutoErrorHandlingEnabled(true);
+ job->exec();
+ }
+ }
}
void KFilePropsPlugin::applyIconChanges()
More information about the kde-doc-english
mailing list