KDELibs4Support

kdirselectdialog.cpp
1 /*
2  Copyright (C) 2001,2002 Carsten Pfeiffer <[email protected]>
3  Copyright (C) 2001 Michael Jarrett <[email protected]>
4  Copyright (C) 2009 Shaun Reich <[email protected]>
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Library General Public
8  License version 2 as published by the Free Software Foundation.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Library General Public License for more details.
14 
15  You should have received a copy of the GNU Library General Public License
16  along with this library; see the file COPYING.LIB. If not, write to
17  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  Boston, MA 02110-1301, USA.
19 */
20 
21 #include "kdirselectdialog.h"
22 
23 #include <QDebug>
24 #include <QDialogButtonBox>
25 #include <QDir>
26 #include <QFileDialog>
27 #include <QInputDialog>
28 #include <QLayout>
29 #include <QMenu>
30 #include <QPushButton>
31 #include <QStandardPaths>
32 #include <QStringList>
33 #include <QUrl>
34 
35 #include <kio/jobuidelegate.h>
36 #include <kactioncollection.h>
37 #include <kauthorized.h>
38 #include <kconfig.h>
39 #include <kconfiggroup.h>
40 #include <kfiletreeview_p.h>
41 #include <kfileitemdelegate.h>
42 #include <khistorycombobox.h>
43 #include <kio/job.h>
44 #include <kio/deletejob.h>
45 #include <kio/copyjob.h>
46 #include <kio/mkdirjob.h>
47 #include <kjobwidgets.h>
48 #include <klocalizedstring.h>
49 #include <kmessagebox.h>
50 #include <kpropertiesdialog.h>
51 #include <krecentdirs.h>
52 #include <kservice.h>
53 #include <ksharedconfig.h>
54 #include <ktoggleaction.h>
55 #include <kurlcompletion.h>
56 #include <kurlpixmapprovider.h>
57 #include <kfilewidget.h>
58 #include <kfileutils.h>
59 
60 #include "kfileplacesview.h"
61 #include "kfileplacesmodel.h"
62 // ### add mutator for treeview!
63 #ifdef stat
64 #undef stat
65 #endif
66 
67 class Q_DECL_HIDDEN KDirSelectDialog::Private
68 {
69 public:
70  Private(bool localOnly, KDirSelectDialog *parent)
71  : m_parent(parent),
72  m_localOnly(localOnly),
73  m_comboLocked(false),
74  m_urlCombo(nullptr)
75  {
76  }
77 
78  void readConfig(const KSharedConfigPtr &config, const QString &group);
79  void saveConfig(KSharedConfigPtr config, const QString &group);
80  void slotMkdir();
81 
82  void slotCurrentChanged();
83  void slotExpand(const QModelIndex &);
84  void slotUrlActivated(const QString &);
85  void slotComboTextChanged(const QString &);
86  void slotContextMenuRequested(const QPoint &);
87  void slotNewFolder();
88  void slotMoveToTrash();
89  void slotDelete();
90  void slotProperties();
91 
92  KDirSelectDialog *m_parent;
93  bool m_localOnly : 1;
94  bool m_comboLocked : 1;
95  QUrl m_rootUrl;
96  QUrl m_startDir;
97  KFileTreeView *m_treeView;
98  QMenu *m_contextMenu;
99  KActionCollection *m_actions;
100  KFilePlacesView *m_placesView;
101  KHistoryComboBox *m_urlCombo;
102  QString m_recentDirClass;
103  QUrl m_startURL;
105  QAction *deleteAction;
106  QAction *showHiddenFoldersAction;
107 };
108 
109 void KDirSelectDialog::Private::readConfig(const KSharedConfig::Ptr &config, const QString &group)
110 {
111  m_urlCombo->clear();
112 
113  KConfigGroup conf(config, group);
114  m_urlCombo->setHistoryItems(conf.readPathEntry("History Items", QStringList()));
115 
116  const QSize size = conf.readEntry("DirSelectDialog Size", QSize());
117  if (size.isValid()) {
118  m_parent->resize(size);
119  }
120 }
121 
122 void KDirSelectDialog::Private::saveConfig(KSharedConfig::Ptr config, const QString &group)
123 {
124  KConfigGroup conf(config, group);
126  conf.writePathEntry("History Items", m_urlCombo->historyItems(), flags);
127  conf.writeEntry("DirSelectDialog Size", m_parent->size(), flags);
128 
129  config->sync();
130 }
131 
132 void KDirSelectDialog::Private::slotMkdir()
133 {
134  bool ok;
135  QString where = m_parent->url().toDisplayString(QUrl::PreferLocalFile);
136  QString name = i18nc("folder name", "New Folder");
137  if (m_parent->url().isLocalFile() && QFileInfo(m_parent->url().toLocalFile() + '/' + name).exists()) {
138  name = KFileUtils::suggestName(m_parent->url(), name);
139  }
140 
141  QString directory = KIO::encodeFileName(QInputDialog::getText(m_parent, i18nc("@title:window", "New Folder"),
142  i18nc("@label:textbox", "Create new folder in:\n%1", where),
143  QLineEdit::Normal, name, &ok));
144  if (!ok) {
145  return;
146  }
147 
148  bool selectDirectory = true;
149  bool writeOk = false;
150  bool exists = false;
151  QUrl folderurl(m_parent->url());
152 
153  const QStringList dirs = directory.split('/', QString::SkipEmptyParts);
154  QStringList::ConstIterator it = dirs.begin();
155 
156  for (; it != dirs.end(); ++it) {
157  folderurl.setPath(folderurl.path() + '/' + *it);
158  KIO::StatJob *job = KIO::stat(folderurl);
159  KJobWidgets::setWindow(job, m_parent);
160  job->setDetails(0); //We only want to know if it exists, 0 == that.
161  job->setSide(KIO::StatJob::DestinationSide);
162  exists = job->exec();
163  if (!exists) {
164  KIO::MkdirJob *job = KIO::mkdir(folderurl);
165  KJobWidgets::setWindow(job, m_parent);
166  writeOk = job->exec();
167  }
168  }
169 
170  if (exists) { // url was already existent
171  QString which = folderurl.toDisplayString(QUrl::PreferLocalFile);
172  KMessageBox::error(m_parent, i18n("A file or folder named %1 already exists.", which));
173  selectDirectory = false;
174  } else if (!writeOk) {
175  KMessageBox::error(m_parent, i18n("You do not have permission to create that folder."));
176  } else if (selectDirectory) {
177  m_parent->setCurrentUrl(folderurl);
178  }
179 }
180 
181 void KDirSelectDialog::Private::slotCurrentChanged()
182 {
183  if (m_comboLocked) {
184  return;
185  }
186 
187  const QUrl u = m_treeView->currentUrl();
188 
189  if (u.isValid()) {
190  m_urlCombo->setEditText(u.toDisplayString(QUrl::PreferLocalFile));
191  } else {
192  m_urlCombo->setEditText(QString());
193  }
194 }
195 
196 void KDirSelectDialog::Private::slotUrlActivated(const QString &text)
197 {
198  if (text.isEmpty()) {
199  return;
200  }
201 
202  const QUrl url = QUrl::fromUserInput(text);
203  m_urlCombo->addToHistory(url.toDisplayString());
204 
205  if (m_parent->localOnly() && !url.isLocalFile()) {
206  return; //FIXME: messagebox for the user
207  }
208 
209  QUrl oldUrl = m_treeView->currentUrl();
210  if (oldUrl.isEmpty()) {
211  oldUrl = m_startDir;
212  }
213 
214  m_parent->setCurrentUrl(oldUrl);
215 }
216 
217 void KDirSelectDialog::Private::slotComboTextChanged(const QString &text)
218 {
219  m_treeView->blockSignals(true);
220  QUrl url = QUrl::fromUserInput(text);
221 #ifdef Q_OS_WIN
222  QUrl rootUrl(m_treeView->rootUrl());
223  if (url.isLocalFile() && !rootUrl.isParentOf(url) && !rootUrl.matches(url, QUrl::StripTrailingSlash)) {
224  QUrl tmp = KIO::upUrl(url);
225  while (tmp.path().length() > 1) {
226  url = tmp;
227  tmp = KIO::upUrl(url);
228  }
229  m_treeView->setRootUrl(url);
230  }
231 #endif
232  m_treeView->setCurrentUrl(url);
233  m_treeView->blockSignals(false);
234 }
235 
236 void KDirSelectDialog::Private::slotContextMenuRequested(const QPoint &pos)
237 {
238  m_contextMenu->popup(m_treeView->viewport()->mapToGlobal(pos));
239 }
240 
241 void KDirSelectDialog::Private::slotExpand(const QModelIndex &index)
242 {
243  m_treeView->setExpanded(index, !m_treeView->isExpanded(index));
244 }
245 
246 void KDirSelectDialog::Private::slotNewFolder()
247 {
248  slotMkdir();
249 }
250 
251 void KDirSelectDialog::Private::slotMoveToTrash()
252 {
253  const QUrl url = m_treeView->selectedUrl();
254  KIO::JobUiDelegate job;
255  if (job.askDeleteConfirmation(QList<QUrl>() << url, KIO::JobUiDelegate::Trash, KIO::JobUiDelegate::DefaultConfirmation)) {
256  KIO::CopyJob *copyJob = KIO::trash(url);
257  KJobWidgets::setWindow(copyJob, m_parent);
258  copyJob->ui()->setAutoErrorHandlingEnabled(true);
259  }
260 }
261 
262 void KDirSelectDialog::Private::slotDelete()
263 {
264  const QUrl url = m_treeView->selectedUrl();
265  KIO::JobUiDelegate job;
266  if (job.askDeleteConfirmation(QList<QUrl>() << url, KIO::JobUiDelegate::Delete, KIO::JobUiDelegate::DefaultConfirmation)) {
267  KIO::DeleteJob *deleteJob = KIO::del(url);
268  KJobWidgets::setWindow(deleteJob, m_parent);
269  deleteJob->ui()->setAutoErrorHandlingEnabled(true);
270  }
271 }
272 
273 void KDirSelectDialog::Private::slotProperties()
274 {
275  KPropertiesDialog *dialog = nullptr;
276  dialog = new KPropertiesDialog(m_treeView->selectedUrl(), this->m_parent);
278  dialog->show();
279 }
280 
281 KDirSelectDialog::KDirSelectDialog(const QUrl &startDir, bool localOnly,
282  QWidget *parent)
283 #ifdef Q_OS_WIN
285 #else
286  : QDialog(parent),
287 #endif
288  d(new Private(localOnly, this))
289 {
290  setWindowTitle(i18nc("@title:window", "Select Folder"));
291 
292  QVBoxLayout *topLayout = new QVBoxLayout;
293  setLayout(topLayout);
294 
295  QFrame *page = new QFrame(this);
296  topLayout->addWidget(page);
297 
298  QPushButton *folderButton = new QPushButton;
299  KGuiItem::assign(folderButton, KGuiItem(i18nc("@action:button", "New Folder..."), "folder-new"));
300  connect(folderButton, SIGNAL(clicked()), this, SLOT(slotNewFolder()));
301 
302  QDialogButtonBox *buttonBox = new QDialogButtonBox(this);
303  buttonBox->addButton(folderButton, QDialogButtonBox::ActionRole);
305  connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
306  connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
307  topLayout->addWidget(buttonBox);
308 
309  QHBoxLayout *hlay = new QHBoxLayout(page);
310  hlay->setContentsMargins(0, 0, 0, 0);
311  QVBoxLayout *mainLayout = new QVBoxLayout();
312  d->m_actions = new KActionCollection(this);
313  d->m_actions->addAssociatedWidget(this);
314  d->m_placesView = new KFilePlacesView(page);
315  d->m_placesView->setModel(new KFilePlacesModel(d->m_placesView));
316  d->m_placesView->setObjectName(QLatin1String("speedbar"));
317  d->m_placesView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
318  d->m_placesView->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
319  connect(d->m_placesView, SIGNAL(urlChanged(QUrl)),
320  SLOT(setCurrentUrl(QUrl)));
321  hlay->addWidget(d->m_placesView);
322  hlay->addLayout(mainLayout);
323 
324  d->m_treeView = new KFileTreeView(page);
325  d->m_treeView->setDirOnlyMode(true);
326  d->m_treeView->setContextMenuPolicy(Qt::CustomContextMenu);
327 
328  for (int i = 1; i < d->m_treeView->model()->columnCount(); ++i) {
329  d->m_treeView->hideColumn(i);
330  }
331 
332  d->m_urlCombo = new KHistoryComboBox(page);
333  d->m_urlCombo->setLayoutDirection(Qt::LeftToRight);
334  d->m_urlCombo->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLength);
335  d->m_urlCombo->setTrapReturnKey(true);
336  d->m_urlCombo->setPixmapProvider(new KUrlPixmapProvider());
337  KUrlCompletion *comp = new KUrlCompletion();
338  comp->setMode(KUrlCompletion::DirCompletion);
339  d->m_urlCombo->setCompletionObject(comp, true);
340  d->m_urlCombo->setAutoDeleteCompletionObject(true);
341  d->m_urlCombo->setDuplicatesEnabled(false);
342 
343  d->m_contextMenu = new QMenu(this);
344 
345  QAction *newFolder = new QAction(i18nc("@action:inmenu", "New Folder..."), this);
346  d->m_actions->addAction(newFolder->objectName(), newFolder);
347  newFolder->setIcon(QIcon::fromTheme("folder-new"));
348  newFolder->setShortcut(Qt::Key_F10);
349  connect(newFolder, SIGNAL(triggered(bool)), this, SLOT(slotNewFolder()));
350  d->m_contextMenu->addAction(newFolder);
351 
352  d->moveToTrash = new QAction(i18nc("@action:inmenu", "Move to Trash"), this);
353  d->m_actions->addAction(d->moveToTrash->objectName(), d->moveToTrash);
354  d->moveToTrash->setIcon(QIcon::fromTheme("user-trash"));
355  d->moveToTrash->setShortcut(Qt::Key_Delete);
356  connect(d->moveToTrash, SIGNAL(triggered(bool)), this, SLOT(slotMoveToTrash()));
357  d->m_contextMenu->addAction(d->moveToTrash);
358 
359  d->deleteAction = new QAction(i18nc("@action:inmenu", "Delete"), this);
360  d->m_actions->addAction(d->deleteAction->objectName(), d->deleteAction);
361  d->deleteAction->setIcon(QIcon::fromTheme("edit-delete"));
362  d->deleteAction->setShortcut(Qt::SHIFT | Qt::Key_Delete);
363  connect(d->deleteAction, SIGNAL(triggered(bool)), this, SLOT(slotDelete()));
364  d->m_contextMenu->addAction(d->deleteAction);
365 
366  d->m_contextMenu->addSeparator();
367 
368  d->showHiddenFoldersAction = new KToggleAction(i18nc("@option:check", "Show Hidden Folders"), this);
369  d->m_actions->addAction(d->showHiddenFoldersAction->objectName(), d->showHiddenFoldersAction);
370  d->showHiddenFoldersAction->setShortcut(Qt::Key_F8);
371  connect(d->showHiddenFoldersAction, SIGNAL(triggered(bool)), d->m_treeView, SLOT(setShowHiddenFiles(bool)));
372  d->m_contextMenu->addAction(d->showHiddenFoldersAction);
373  d->m_contextMenu->addSeparator();
374 
375  QAction *propertiesAction = new QAction(i18nc("@action:inmenu", "Properties"), this);
376  d->m_actions->addAction(propertiesAction->objectName(), propertiesAction);
377  propertiesAction->setIcon(QIcon::fromTheme("document-properties"));
378  propertiesAction->setShortcut(Qt::ALT | Qt::Key_Return);
379  connect(propertiesAction, SIGNAL(triggered(bool)), this, SLOT(slotProperties()));
380  d->m_contextMenu->addAction(propertiesAction);
381 
382  d->m_startURL = KFileWidget::getStartUrl(startDir, d->m_recentDirClass);
383  if (localOnly && !d->m_startURL.isLocalFile()) {
384  d->m_startURL = QUrl();
386  if (QDir(docPath).exists()) {
387  d->m_startURL.setPath(docPath);
388  } else {
389  d->m_startURL.setPath(QDir::homePath());
390  }
391  }
392 
393  d->m_startDir = d->m_startURL;
394  d->m_rootUrl = d->m_treeView->rootUrl();
395 
396  d->readConfig(KSharedConfig::openConfig(), "DirSelect Dialog");
397 
398  mainLayout->addWidget(d->m_treeView, 1);
399  mainLayout->addWidget(d->m_urlCombo, 0);
400 
401  connect(d->m_treeView, SIGNAL(currentChanged(QUrl)),
402  SLOT(slotCurrentChanged()));
403  connect(d->m_treeView, SIGNAL(activated(QModelIndex)),
404  SLOT(slotExpand(QModelIndex)));
405  connect(d->m_treeView, SIGNAL(customContextMenuRequested(QPoint)),
406  SLOT(slotContextMenuRequested(QPoint)));
407 
408  connect(d->m_urlCombo, SIGNAL(editTextChanged(QString)),
409  SLOT(slotComboTextChanged(QString)));
410  connect(d->m_urlCombo, SIGNAL(activated(QString)),
411  SLOT(slotUrlActivated(QString)));
412  connect(d->m_urlCombo, SIGNAL(returnPressed(QString)),
413  SLOT(slotUrlActivated(QString)));
414 
415  setCurrentUrl(d->m_startURL);
416 }
417 
419 {
420  delete d;
421 }
422 
424 {
425  QUrl comboUrl = QUrl::fromUserInput(d->m_urlCombo->currentText());
426 
427  if (comboUrl.isValid()) {
428  KIO::StatJob *statJob = KIO::stat(comboUrl, KIO::HideProgressInfo);
429  KJobWidgets::setWindow(statJob, d->m_parent);
430  const bool ok = statJob->exec();
431  if (ok && statJob->statResult().isDir()) {
432  return comboUrl;
433  }
434  }
435 
436  // qDebug() << comboUrl.path() << " is not an accessible directory";
437  return d->m_treeView->currentUrl();
438 }
439 
441 {
442  return d->m_treeView;
443 }
444 
446 {
447  return d->m_localOnly;
448 }
449 
451 {
452  return d->m_startDir;
453 }
454 
456 {
457  if (!url.isValid()) {
458  return;
459  }
460 
461  if (url.scheme() != d->m_rootUrl.scheme()) {
462  QUrl u(url);
463  u.setPath("/");//NOTE portability?
464  d->m_treeView->setRootUrl(u);
465  d->m_rootUrl = u;
466  }
467 
468  //Check if url represents a hidden folder and enable showing them
469  QString fileName = url.fileName();
470  //TODO a better hidden file check?
471  bool isHidden = fileName.length() > 1 && fileName[0] == '.' &&
472  (fileName.length() > 2 ? fileName[1] != '.' : true);
473  bool showHiddenFiles = isHidden && !d->m_treeView->showHiddenFiles();
474  if (showHiddenFiles) {
475  d->showHiddenFoldersAction->setChecked(true);
476  d->m_treeView->setShowHiddenFiles(true);
477  }
478 
479  d->m_treeView->setCurrentUrl(url);
480 }
481 
482 void KDirSelectDialog::accept()
483 {
484  QUrl selectedUrl = url();
485  if (!selectedUrl.isValid()) {
486  return;
487  }
488 
489  if (!d->m_recentDirClass.isEmpty()) {
490  KRecentDirs::add(d->m_recentDirClass, selectedUrl.toString());
491  }
492 
493  d->m_urlCombo->addToHistory(selectedUrl.toDisplayString());
495 
496  QDialog::accept();
497 }
498 
500 {
501  d->saveConfig(KSharedConfig::openConfig(), "DirSelect Dialog");
502 
504 }
505 
506 // static
508  bool localOnly,
509  QWidget *parent,
510  const QString &caption)
511 {
513 
514  if (!caption.isNull()) {
515  myDialog.setWindowTitle(caption);
516  }
517 
518  if (myDialog.exec() == QDialog::Accepted) {
519  QUrl url = myDialog.url();
520 
521  //Returning the most local url
522  if (url.isLocalFile()) {
523  return url;
524  }
525 
526  KIO::StatJob *job = KIO::stat(url);
528 
529  if (!job->exec()) {
530  return url;
531  }
532 
533  KIO::UDSEntry entry = job->statResult();
535 
536  return path.isEmpty() ? url : QUrl::fromLocalFile(path);
537  } else {
538  return QUrl();
539  }
540 }
541 
542 #include "moc_kdirselectdialog.cpp"
static QUrl selectDirectory(const QUrl &startDir=QUrl(), bool localOnly=false, QWidget *parent=nullptr, const QString &caption=QString())
Creates a KDirSelectDialog, and returns the result.
bool isNull() const const
bool isValid() const const
QAbstractItemView * view() const
Returns a pointer to the view which is used for displaying the directories.
bool localOnly() const
Returns whether only local directories can be selected.
QString scheme() const const
QStringList split(const QString &sep, QString::SplitBehavior behavior, Qt::CaseSensitivity cs) const const
KJOBWIDGETS_EXPORT void setWindow(KJob *job, QWidget *widget)
bool isDir() const
virtual bool event(QEvent *event) override
void readConfig()
Reads the file share configuration file.
Definition: kfileshare.cpp:108
QIcon fromTheme(const QString &name)
CustomContextMenu
QString writableLocation(QStandardPaths::StandardLocation type)
ScrollBarAlwaysOff
void setShortcut(const QKeySequence &shortcut)
QString homePath()
KIOCORE_EXPORT CopyJob * trash(const QUrl &src, JobFlags flags=DefaultFlags)
void setAttribute(Qt::WidgetAttribute attribute, bool on)
KIOCORE_EXPORT QString encodeFileName(const QString &str)
QString caption()
Returns a text for the window caption.
Definition: kglobal.cpp:175
bool exists() const const
static QUrl getStartUrl(const QUrl &startDir, QString &recentDirClass)
KIOFILEWIDGETS_EXPORT void add(const QString &fileClass, const QString &directory)
static KSharedConfig::Ptr openConfig(const QString &fileName=QString(), OpenFlags mode=FullConfig, QStandardPaths::StandardLocation type=QStandardPaths::GenericConfigLocation)
void setStandardButtons(QDialogButtonBox::StandardButtons buttons)
void addWidget(QWidget *widget, int stretch, Qt::Alignment alignment)
QString stringValue(uint field) const
void error(QWidget *parent, const QString &text, const QString &title=QString(), Options options=Notify)
bool isValid() const const
WindowMinMaxButtonsHint
void setIcon(const QIcon &icon)
virtual void hideEvent(QHideEvent *event)
static void assign(QPushButton *button, const KGuiItem &item)
QString toString(QUrl::FormattingOptions options) const const
AdjustToMinimumContentsLength
QString i18n(const char *text, const TYPE &arg...)
int mkdir(const QString &pathname, mode_t mode)
replacement for mkdir() to handle pathnames in a platform independent way
Definition: kde_file.h:195
KIOCORE_EXPORT DeleteJob * del(const QUrl &src, JobFlags flags=DefaultFlags)
bool isEmpty() const const
QAction * moveToTrash(const QObject *recvr, const char *slot, QObject *parent)
PreferLocalFile
KDirSelectDialog(const QUrl &startDir=QUrl(), bool localOnly=false, QWidget *parent=nullptr)
Creates a new directory selection dialog.
bool isEmpty() const const
QUrl fromLocalFile(const QString &localFile)
QString fileName(QUrl::ComponentFormattingOptions options) const const
int length() const const
QString toDisplayString(QUrl::FormattingOptions options) const const
void setWindowTitle(const QString &)
QString getText(QWidget *parent, const QString &title, const QString &label, QLineEdit::EchoMode mode, const QString &text, bool *ok, Qt::WindowFlags flags, Qt::InputMethodHints inputMethodHints)
virtual void accept()
void addButton(QAbstractButton *button, QDialogButtonBox::ButtonRole role)
virtual int exec()
KCOREADDONS_EXPORT QString suggestName(const QUrl &baseURL, const QString &oldName)
KIOCORE_EXPORT QUrl upUrl(const QUrl &url)
~KDirSelectDialog() override
Destroys the directory selection dialog.
void setCurrentUrl(const QUrl &url)
Sets the current url in the dialog.
KSharedConfigPtr config()
Returns the general config object.
Definition: kglobal.cpp:102
const UDSEntry & statResult() const
KJobUiDelegate * ui() const
void show()
typedef ConstIterator
virtual void setMode(Mode mode)
void setSide(bool source)
QString path(QUrl::ComponentFormattingOptions options) const const
void setPath(const QString &path, QUrl::ParsingMode mode)
KStandardDirs * dirs()
Returns the application standard dirs object.
Definition: kglobal.cpp:89
bool isLocalFile() const const
const char * name(StandardAction id)
A pretty dialog for a KDirSelect control for selecting directories.
LeftToRight
void setContentsMargins(int left, int top, int right, int bottom)
QString i18nc(const char *context, const char *text, const TYPE &arg...)
void setDetails(KIO::StatDetail detail)
void addLayout(QLayout *layout, int stretch)
bool isHidden() const const
static void setStartDir(const QUrl &directory)
QObject * parent() const const
WA_DeleteOnClose
bool exec()
QUrl fromUserInput(const QString &userInput)
void hideEvent(QHideEvent *event) override
Reimplemented for saving the dialog geometry.
QUrl url() const
Returns the currently selected URL, or an empty one if no item is selected.
bool askDeleteConfirmation(const QList< QUrl > &urls, DeletionType deletionType, ConfirmationType confirmationType) override
void setAutoErrorHandlingEnabled(bool enable)
int stat(const QString &path, KDE_struct_stat *buf)
replacement for stat()/::stat64() to handle filenames in a platform independent way
Definition: kde_file.h:207
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sat Sep 30 2023 03:56:37 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.