Summary: | Rename should only select the non-extension part of the filename | ||
---|---|---|---|
Product: | [Applications] gwenview | Reporter: | Stephan Sokolow <kde_bugzilla_2> |
Component: | general | Assignee: | Gwenview Bugs <gwenview-bugs-null> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Compiled Sources | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: |
Description
Stephan Sokolow
2006-07-07 14:56:22 UTC
SVN commit 562351 by gateau: - Implemented our own input dialog, so that we can: - Select only a part of the text - Set custom GuiItems on OK button - Use this dialog to create folders and rename files. BUG:130408 M +2 -0 NEWS M +2 -20 app/dirviewcontroller.cpp M +1 -1 app/dirviewcontroller.h M +1 -0 gvcore/Makefile.am M +2 -1 gvcore/fileoperation.cpp M +1 -1 gvcore/fileoperation.h M +23 -16 gvcore/fileopobject.cpp A gvcore/inputdialog.cpp [License: GPL (v2+) (wrong address)] A gvcore/inputdialog.h [License: GPL (v2+) (wrong address)] --- trunk/extragear/graphics/gwenview/NEWS #562350:562351 @@ -4,6 +4,8 @@ (Bug 98740). - An entry to start the slide show has been added to the image popup menu (Bug 130407). + - In the rename dialogs, the file extension is no longer selected by + default (Bug 130408) - Fixes: - Fixed file renaming, which got broken in 1.3.91. - Do not reset filters when configuring image list. --- trunk/extragear/graphics/gwenview/app/dirviewcontroller.cpp #562350:562351 @@ -104,30 +104,12 @@ void DirViewController::makeDir() { - KIO::Job* job; if (!d->mTreeView->currentItem()) return; - - bool ok; - QString newDir=KInputDialog::getText( - i18n("Creating Folder"), - i18n("Enter the name of the new folder:"), - QString::null, &ok, d->mTreeView); - if (!ok) return; - - KURL newURL(d->mTreeView->currentURL()); - newURL.addPath(newDir); - job=KIO::mkdir(newURL); - - connect(job, SIGNAL(result(KIO::Job*)), - this, SLOT(slotDirMade(KIO::Job*)) ); + FileOperation::makeDir(d->mTreeView->currentURL(), d->mTreeView, this, SLOT(slotDirMade()) ); } -void DirViewController::slotDirMade(KIO::Job* job) { - if (job->error()) { - job->showErrorDialog(d->mTreeView); - return; - } +void DirViewController::slotDirMade() { if (!d->mTreeView->currentItem()) return; d->mTreeView->currentItem()->setOpen(true); } --- trunk/extragear/graphics/gwenview/app/dirviewcontroller.h #562350:562351 @@ -60,7 +60,7 @@ void slotTreeViewContextMenu(KListView*, QListViewItem*, const QPoint&); void makeDir(); - void slotDirMade(KIO::Job*); + void slotDirMade(); void renameDir(); void removeDir(); void showPropertiesDialog(); --- trunk/extragear/graphics/gwenview/gvcore/Makefile.am #562350:562351 @@ -63,6 +63,7 @@ bcgdialogbase.ui \ timeutils.cpp \ clicklineedit.cpp \ + inputdialog.cpp \ miscconfig.kcfgc \ slideshowconfig.kcfgc \ fileoperationconfig.kcfgc \ --- trunk/extragear/graphics/gwenview/gvcore/fileoperation.cpp #562350:562351 @@ -56,8 +56,9 @@ (*op)(); } -void makeDir(const KURL& parentURL, QWidget* parent) { +void makeDir(const KURL& parentURL, QWidget* parent, QObject* receiver, const char* slot) { FileOpObject* op=new FileOpMakeDirObject(parentURL, parent); + if (receiver && slot) QObject::connect(op,SIGNAL(success()),receiver,slot); (*op)(); } --- trunk/extragear/graphics/gwenview/gvcore/fileoperation.h #562350:562351 @@ -42,7 +42,7 @@ LIBGWENVIEW_EXPORT void copyTo(const KURL::List&,QWidget* parent=0L); LIBGWENVIEW_EXPORT void moveTo(const KURL::List&,QWidget* parent,QObject* receiver=0L,const char* slot=0L); LIBGWENVIEW_EXPORT void linkTo(const KURL::List& srcURL,QWidget* parent); -LIBGWENVIEW_EXPORT void makeDir(const KURL& parentURL, QWidget* parent); +LIBGWENVIEW_EXPORT void makeDir(const KURL& parentURL, QWidget* parent, QObject* receiver=0L, const char* slot=0L); LIBGWENVIEW_EXPORT void del(const KURL::List&,QWidget* parent,QObject* receiver=0L,const char* slot=0L); LIBGWENVIEW_EXPORT void trash(const KURL::List&,QWidget* parent,QObject* receiver=0L,const char* slot=0L); LIBGWENVIEW_EXPORT void realDelete(const KURL::List&,QWidget* parent,QObject* receiver=0L,const char* slot=0L); --- trunk/extragear/graphics/gwenview/gvcore/fileopobject.cpp #562350:562351 @@ -29,7 +29,7 @@ #include <kfiledialog.h> #include <kfilefiltercombo.h> #include <kglobalsettings.h> -#include <kinputdialog.h> +#include <klineedit.h> #include <klocale.h> #include <kmessagebox.h> #include <kstandarddirs.h> @@ -39,6 +39,7 @@ #include "fileoperation.h" #include "fileopobject.moc" #include "fileoperationconfig.h" +#include "inputdialog.h" namespace Gwenview { @@ -187,12 +188,13 @@ //-FileOpMakeDirObject------------------------------------------------------------- void FileOpMakeDirObject::operator()() { - bool ok; - QString newDir=KInputDialog::getText( - i18n("Creating Folder"), - i18n("Enter the name of the new folder:"), - QString::null, &ok, mParent); - if (!ok) return; + InputDialog dlg(mParent); + dlg.setCaption( i18n("Creating Folder") ); + dlg.setLabel( i18n("Enter the name of the new folder:") ); + dlg.setButtonOK( KGuiItem(i18n("Create Folder"), "folder_new") ); + if (!dlg.exec()) return; + + QString newDir = dlg.lineEdit()->text(); KURL newURL(mURLList.first()); newURL.addPath(newDir); @@ -276,19 +278,24 @@ //-FileOpRenameObject-------------------------------------------------------------- void FileOpRenameObject::operator()() { - bool ok; KURL srcURL=mURLList.first(); -// Prompt for the new filename - QString filename=QStyleSheet::escape(srcURL.filename()); - mNewFilename=KInputDialog::getText(i18n("Renaming File"), - i18n("<p>Rename file <b>%1</b> to:</p>").arg(filename), - srcURL.filename(), - &ok,mParent); + // Prompt for the new filename + QString filename = srcURL.filename(); + InputDialog dlg(mParent); + dlg.setCaption(i18n("Renaming File")); + dlg.setLabel(i18n("<p>Rename file <b>%1</b> to:</p>").arg(QStyleSheet::escape(filename))); + dlg.setButtonOK( KGuiItem(i18n("Rename"), "edit") ); - if (!ok) return; + dlg.lineEdit()->setText(filename); + int extPos = filename.findRev('.'); + if (extPos != -1) { + dlg.lineEdit()->setSelection(0, extPos); + } + if (!dlg.exec()) return; + mNewFilename = dlg.lineEdit()->text(); -// Rename the file + // Rename the file KURL destURL=srcURL; destURL.setFileName(mNewFilename); KIO::Job* job=KIO::move(srcURL,destURL); |