diff options
author | Arno <am@disconnect.de> | 2013-10-12 19:52:41 +0200 |
---|---|---|
committer | Arno <am@disconnect.de> | 2013-10-12 19:52:41 +0200 |
commit | ba7e76a2ee167aff632fdd8bd4d9b840b20bbd16 (patch) | |
tree | 553166d11bf6bedc25031942f5b1e93e833c6e58 /filesystemwidget.cpp | |
parent | 039c05ea483523f93d818295cc7ed11633867338 (diff) | |
download | SheMov-ba7e76a2ee167aff632fdd8bd4d9b840b20bbd16.tar.gz SheMov-ba7e76a2ee167aff632fdd8bd4d9b840b20bbd16.tar.bz2 SheMov-ba7e76a2ee167aff632fdd8bd4d9b840b20bbd16.zip |
Fix Rename in FilesystemWidget
Use a dialog for renaming files. Craptastic. Dunno why just calling the
editor doesn't work any more, but that's life...
Diffstat (limited to 'filesystemwidget.cpp')
-rw-r--r-- | filesystemwidget.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/filesystemwidget.cpp b/filesystemwidget.cpp index 3f550a4..6fbe552 100644 --- a/filesystemwidget.cpp +++ b/filesystemwidget.cpp @@ -21,6 +21,7 @@ #include <QTimer> #include <QProgressDialog> #include <QToolBar> +#include <QInputDialog> #include "filesystemwidget.h" #include "filesystemdirproxy.h" @@ -307,7 +308,16 @@ void FilesystemWidget::renameFile(){ if(curIdx.data().toString() == ".."){ return; } - mFileView->edit(curIdx); + bool ok = false; + QString fileName = curIdx.data(SmDirModel::NameRole).toString(); + QString l1 = QString(tr("Rename %1").arg(fileName)); + QString newName = QInputDialog::getText(this, tr("Rename file"), l1, QLineEdit::Normal, fileName, &ok); + if(ok){ + QFileInfo fi(curIdx.data(SmDirModel::FullPathRole).toString()); + QString nfn = QString("%1/%2").arg(fi.absolutePath()).arg(newName); + QFile f(fi.absoluteFilePath()); + f.rename(nfn); + } } void FilesystemWidget::playSelected(const QString &player){ |