diff options
author | Michele Calgaro <[email protected]> | 2016-10-01 22:22:03 +0900 |
---|---|---|
committer | Michele Calgaro <[email protected]> | 2016-10-01 23:00:33 +0900 |
commit | c8ff908d9e929d1099cec67c4b5a2330a9b57023 (patch) | |
tree | 2b8141b92c33e85ce0b631a0d81365806dd22f47 | |
parent | aca395819150543f3d769c2ed9b2fff05e1bbb61 (diff) | |
download | tdelibs-c8ff908d9e929d1099cec67c4b5a2330a9b57023.tar.gz tdelibs-c8ff908d9e929d1099cec67c4b5a2330a9b57023.zip |
Fixed two issues with KFileDialog:
- if the user types a new path manually, the new location was not used. Instead the older path was taken.
In case the typed path does not exists, an error message is displayed
- if the user selected a path from the autocompletion lists using the mouse, the new selected location was
not used when slotOK was invoked.
This resolves bug 2654.
Signed-off-by: Michele Calgaro <[email protected]>
(cherry picked from commit 53e36f6db011540746db8f91cf717ab1d8d912b4)
-rw-r--r-- | tdeio/tdefile/tdefiledialog.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/tdeio/tdefile/tdefiledialog.cpp b/tdeio/tdefile/tdefiledialog.cpp index a004ae177..24d9f8e06 100644 --- a/tdeio/tdefile/tdefiledialog.cpp +++ b/tdeio/tdefile/tdefiledialog.cpp @@ -334,6 +334,20 @@ void KFileDialog::slotOk() { kdDebug(tdefile_area) << "slotOK\n"; + // If the user typed in the path field without confirming it with ENTER, + // "ops" will most likely point do a different folder. Make sure the folder exists, + // then update "ops" accordingly and only if necessary + TQDir savedir = TQDir(d->pathCombo->lineEdit()->text()); + if (!savedir.exists()) + { + KMessageBox::information(this, i18n("The selected folder does not exists. Please select an existing one.")); + return; + } + if (ops->url().path(1) != KURL(savedir.absPath()).path(1)) + { + setURL(savedir.absPath()); + } + // a list of all selected files/directories (if any) // can only be used if the user didn't type any filenames/urls himself const KFileItemList *items = ops->selectedItems(); @@ -981,9 +995,11 @@ void KFileDialog::init(const TQString& startDir, const TQString& filter, TQWidge d->pathCombo->setCompletionObject( pathCompletionObj ); d->pathCombo->setAutoDeleteCompletionObject( true ); - connect( d->pathCombo, TQT_SIGNAL( urlActivated( const KURL& )), + connect( d->pathCombo, TQT_SIGNAL( urlActivated( const KURL& )), this, TQT_SLOT( enterURL( const KURL& ) )); - connect( d->pathCombo, TQT_SIGNAL( returnPressed( const TQString& )), + connect( d->pathCombo, TQT_SIGNAL( returnPressed( const TQString& )), + this, TQT_SLOT( enterURL( const TQString& ) )); + connect( d->pathCombo, TQT_SIGNAL( activated( const TQString& )), this, TQT_SLOT( enterURL( const TQString& ) )); TQString whatsThisText; |