59 #include <QtGui/QCheckBox>
60 #include <QtGui/QDockWidget>
61 #include <QtGui/QLayout>
62 #include <QtGui/QLabel>
63 #include <QtGui/QLineEdit>
64 #include <QtGui/QSplitter>
65 #include <QtGui/QAbstractProxyModel>
66 #include <QtGui/QHelpEvent>
67 #include <QtGui/QApplication>
68 #include <QtCore/QFSFileEngine>
73 class KFileWidgetPrivate
81 placesViewSplitter(0),
83 labeledCustomWidget(0),
84 bottomCustomWidget(0),
85 autoSelectExtCheckBox(0),
92 autoSelectExtChecked(false),
95 hasDefaultFilter(false),
98 confirmOverwrite(false),
99 differentHierarchyLevelItemsEntered(false),
105 ~KFileWidgetPrivate()
107 delete bookmarkHandler;
111 void updateLocationWhatsThis();
112 void updateAutoSelectExtension();
115 void readViewConfig();
116 void writeViewConfig();
117 void setNonExtSelection();
118 void setLocationText(
const KUrl&);
120 void appendExtension(
KUrl &url);
121 void updateLocationEditExtension(
const QString &);
134 void readRecentFiles();
138 void saveRecentFiles();
143 void multiSelectionChanged();
155 bool usePreviousPixmapIfNull =
true);
160 void removeDummyHistoryEntry();
168 bool toOverwrite(
const KUrl&);
171 void _k_slotLocationChanged(
const QString& );
172 void _k_urlEntered(
const KUrl& );
173 void _k_enterUrl(
const KUrl& );
174 void _k_enterUrl(
const QString& );
175 void _k_locationAccepted(
const QString& );
176 void _k_slotFilterChanged();
177 void _k_fileHighlighted(
const KFileItem& );
178 void _k_fileSelected(
const KFileItem& );
179 void _k_slotLoadingFinished();
180 void _k_fileCompletion(
const QString& );
181 void _k_toggleSpeedbar(
bool );
182 void _k_toggleBookmarks(
bool );
183 void _k_slotAutoSelectExtClicked();
184 void _k_placesViewSplitterMoved(
int,
int);
185 void _k_activateUrlNavigator();
186 void _k_zoomOutIconsSize();
187 void _k_zoomInIconsSize();
188 void _k_slotIconSizeSliderMoved(
int);
189 void _k_slotIconSizeChanged(
int);
191 void addToRecentDocuments();
193 QString locationEditCurrentText()
const;
202 void setInlinePreviewShown(
bool show);
262 bool autoSelectExtChecked : 1;
266 bool keepLocation : 1;
272 bool hasDefaultFilter : 1;
273 bool autoDirectoryFollowing : 1;
277 bool confirmOverwrite : 1;
278 bool differentHierarchyLevelItemsEntered;
290 static const
char autocompletionWhatsThisText[] = I18N_NOOP("<qt>While typing in the text area, you may be presented "
291 "with possible matches. "
292 "This feature can be controlled by clicking with the right mouse button "
293 "and selecting a preferred mode from the <b>Text Completion</b> menu.</qt>");
298 int len =
string.length();
299 static const char prot[] =
":/";
300 for (
int i=0; i < len;) {
305 for (; j >= 0; j--) {
306 const QChar& ch(
string[j] );
309 if (ch.
isSpace() && (i-j-1) >= 2)
322 KUrl startDir(_startDir);
327 d->okButton->setDefault(
true);
331 d->cancelButton->hide();
333 d->opsWidget =
new QWidget(
this);
338 d->toolbar =
new KToolBar(d->opsWidget,
true);
339 d->toolbar->setObjectName(
"KFileWidget::toolbar");
340 d->toolbar->setMovable(
false);
347 d->url =
getStartUrl( startDir, d->fileClass, filename );
357 d->urlNavigator->setPlacesSelectorVisible(
false);
358 opsWidgetLayout->
addWidget(d->urlNavigator);
397 d->ops->setObjectName(
"KFileWidget::ops" );
398 d->ops->setIsSaving(d->operationMode ==
Saving);
401 SLOT(_k_urlEntered(
KUrl)));
406 connect(d->ops, SIGNAL(finishedLoading()),
407 SLOT(_k_slotLoadingFinished()));
424 "For instance, if the current location is file:/home/%1 clicking this "
425 "button will take you to file:/home.</qt>",
KUser().loginName() ));
427 coll->
action(
"back" )->
setWhatsThis(
i18n(
"Click this button to move backwards one step in the browsing history."));
428 coll->
action(
"forward" )->
setWhatsThis(
i18n(
"Click this button to move forward one step in the browsing history."));
430 coll->
action(
"reload" )->
setWhatsThis(
i18n(
"Click this button to reload the contents of the current location."));
434 KAction *goToNavigatorAction = coll->
addAction(
"gotonavigator",
this, SLOT(_k_activateUrlNavigator()) );
439 coll->
addAction(
"toggleSpeedbar", showSidebarAction);
441 connect( showSidebarAction, SIGNAL(toggled(
bool)),
442 SLOT(_k_toggleSpeedbar(
bool)) );
446 coll->
addAction(
"toggleBookmarks", showBookmarksAction);
447 connect( showBookmarksAction, SIGNAL(toggled(
bool)),
448 SLOT(_k_toggleBookmarks(
bool)) );
452 menu->
setWhatsThis(
i18n(
"<qt>This is the preferences menu for the file dialog. "
453 "Various options can be accessed from this menu including: <ul>"
454 "<li>how files are sorted in the list</li>"
455 "<li>types of view, including icon and list</li>"
456 "<li>showing of hidden files</li>"
457 "<li>the Places navigation panel</li>"
458 "<li>file previews</li>"
459 "<li>separating folders from files</li></ul></qt>"));
478 d->ops, SLOT(updateSelectionDependentActions()));
480 d->iconSizeSlider =
new QSlider(
this);
481 d->iconSizeSlider->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed);
482 d->iconSizeSlider->setOrientation(Qt::Horizontal);
483 d->iconSizeSlider->setMinimum(0);
484 d->iconSizeSlider->setMaximum(100);
485 d->iconSizeSlider->installEventFilter(
this);
486 connect(d->iconSizeSlider, SIGNAL(valueChanged(
int)),
487 d->ops, SLOT(setIconsZoom(
int)));
488 connect(d->iconSizeSlider, SIGNAL(valueChanged(
int)),
489 this, SLOT(_k_slotIconSizeChanged(
int)));
490 connect(d->iconSizeSlider, SIGNAL(sliderMoved(
int)),
491 this, SLOT(_k_slotIconSizeSliderMoved(
int)));
492 connect(d->ops, SIGNAL(currentIconSizeChanged(
int)),
493 d->iconSizeSlider, SLOT(setValue(
int)));
496 connect(furtherAction, SIGNAL(triggered()), SLOT(_k_zoomOutIconsSize()));
498 connect(closerAction, SIGNAL(triggered()), SLOT(_k_zoomInIconsSize()));
501 midSpacer->
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
509 d->toolbar->addAction(coll->
action(
"back" ));
510 d->toolbar->addAction(coll->
action(
"forward"));
511 d->toolbar->addAction(coll->
action(
"up"));
512 d->toolbar->addAction(coll->
action(
"reload"));
513 d->toolbar->addAction(separator);
514 d->toolbar->addAction(coll->
action(
"inline preview"));
515 d->toolbar->addWidget(midSpacer);
516 d->toolbar->addAction(furtherAction);
517 d->toolbar->addWidget(d->iconSizeSlider);
518 d->toolbar->addAction(closerAction);
519 d->toolbar->addAction(separator2);
520 d->toolbar->addAction(coll->
action(
"mkdir"));
521 d->toolbar->addAction(menu);
523 d->toolbar->setToolButtonStyle(Qt::ToolButtonIconOnly);
524 d->toolbar->setMovable(
false);
530 connect( d->urlNavigator, SIGNAL(urlChanged(
KUrl)),
531 this, SLOT(_k_enterUrl(
KUrl)));
532 connect( d->urlNavigator, SIGNAL(returnPressed()),
538 d->locationLabel =
new QLabel(
i18n(
"&Name:"),
this);
540 d->locationEdit->installEventFilter(
this);
544 d->locationEdit->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLength);
546 SLOT(_k_slotLocationChanged(
QString)) );
548 d->updateLocationWhatsThis();
549 d->locationLabel->setBuddy(d->locationEdit);
552 d->locationEdit->setCompletionObject( fileCompletionObj );
553 d->locationEdit->setAutoDeleteCompletionObject(
true );
555 SLOT(_k_fileCompletion(
QString)) );
558 this, SLOT(_k_locationAccepted(
QString)));
561 whatsThisText =
i18n(
"<qt>This is the filter to apply to the file list. "
562 "File names that do not match the filter will not be shown.<p>"
563 "You may select from one of the preset filters in the "
564 "drop down menu, or you may enter a custom filter "
565 "directly into the text area.</p><p>"
566 "Wildcards such as * and ? are allowed.</p></qt>");
567 d->filterLabel =
new QLabel(
i18n(
"&Filter:"),
this);
568 d->filterLabel->setWhatsThis(whatsThisText);
573 d->filterWidget->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLength);
574 d->filterWidget->setWhatsThis(whatsThisText);
575 d->filterLabel->setBuddy(d->filterWidget);
578 d->filterDelayTimer.setSingleShot(
true);
579 d->filterDelayTimer.setInterval(300);
580 connect(d->filterWidget, SIGNAL(editTextChanged(
QString)), &d->filterDelayTimer, SLOT(start()));
581 connect(&d->filterDelayTimer, SIGNAL(
timeout()), SLOT(_k_slotFilterChanged()));
585 d->autoSelectExtCheckBox =
new QCheckBox (
this);
586 d->autoSelectExtCheckBox->setStyleSheet(
QString(
"QCheckBox { padding-top: %1px; }").arg(KDialog::spacingHint()));
587 connect(d->autoSelectExtCheckBox, SIGNAL(clicked()), SLOT(_k_slotAutoSelectExtClicked()));
597 d->iconSizeSlider->setValue(d->ops->iconsZoom());
611 bool statRes =
false;
620 kDebug(
kfile_area) <<
"statJob -> startDir" << startDir <<
"filename" << filename;
624 d->ops->setUrl(startDir,
true);
625 d->urlNavigator->setLocationUrl(startDir);
627 d->placesView->setUrl(startDir);
633 QLineEdit* lineEdit = d->locationEdit->lineEdit();
636 d->setLocationText(filename);
645 d->locationEdit->setFocus();
658 d->locationLabel->setText(text);
668 if (pos > 0 && filter[pos - 1] !=
'\\') {
678 for (pos = 0; (pos = copy.
indexOf(
"\\/", pos)) != -1; ++
pos)
681 d->ops->clearFilter();
682 d->filterWidget->setFilter(copy);
683 d->ops->setNameFilter(d->filterWidget->currentFilter());
685 d->hasDefaultFilter =
false;
686 d->filterWidget->setEditable(
true );
688 d->updateAutoSelectExtension ();
693 return d->filterWidget->currentFilter();
699 d->filterWidget->setMimeFilter( mimeTypes, defaultType );
701 QStringList types = d->filterWidget->currentFilter().split(
' ', QString::SkipEmptyParts);
703 d->ops->clearFilter();
704 d->ops->setMimeFilter( types );
705 d->hasDefaultFilter = !defaultType.
isEmpty();
706 d->filterWidget->setEditable( !d->hasDefaultFilter ||
707 d->operationMode !=
Saving );
709 d->updateAutoSelectExtension ();
714 d->filterWidget->setFilter(
QString() );
715 d->ops->clearFilter();
716 d->hasDefaultFilter =
false;
717 d->filterWidget->setEditable(
true );
719 d->updateAutoSelectExtension ();
724 int i = d->filterWidget->currentIndex();
725 if (d->filterWidget->showsAllTypes() && i == 0)
728 return d->filterWidget->filters()[i];
737 d->ops->setPreviewWidget(w);
738 d->ops->clearHistory();
742 KUrl KFileWidgetPrivate::getCompleteUrl(
const QString &_url)
const
752 KUrl relativeUrlTest(ops->url());
754 if (!ops->dirLister()->findByUrl(relativeUrlTest).isNull() ||
773 KUrl::List locationEditCurrentTextList(d->tokenize(locationEditCurrentText));
774 KFile::Modes
mode = d->ops->mode();
777 if (!locationEditCurrentTextList.count()) {
789 if (locationEditCurrentTextList.count() > 1) {
790 if (mode & KFile::File) {
792 i18n(
"You can only select one file"),
793 i18n(
"More than one file provided"));
817 if (!d->differentHierarchyLevelItemsEntered) {
828 while (!res && start < locationEditCurrentTextList.count()) {
829 topMostUrl = locationEditCurrentTextList.at(start);
845 for (
int i = start; i < locationEditCurrentTextList.count(); ++i) {
846 KUrl currUrl = locationEditCurrentTextList.at(i);
857 topMostUrl = topMostUrl.
upUrl();
863 for (
int i = 0; i < locationEditCurrentTextList.count(); ++i) {
864 locationEditCurrentTextList[i] =
KUrl::relativeUrl(topMostUrl, locationEditCurrentTextList[i]);
867 d->ops->setUrl(topMostUrl,
true);
868 const bool signalsBlocked = d->locationEdit->lineEdit()->blockSignals(
true);
870 foreach (
const KUrl &url, locationEditCurrentTextList) {
873 d->locationEdit->lineEdit()->setText(
QString(
"\"%1\"").arg(stringList.
join(
"\" \"")));
874 d->locationEdit->lineEdit()->blockSignals(signalsBlocked);
876 d->differentHierarchyLevelItemsEntered =
true;
883 }
else if (locationEditCurrentTextList.count()) {
891 KUrl url(locationEditCurrentText);
892 if (d->operationMode ==
Opening) {
905 KUrl directory = url;
918 d->ops->setUrl(url,
true);
919 const bool signalsBlocked = d->locationEdit->lineEdit()->blockSignals(
true);
920 d->locationEdit->lineEdit()->setText(fileName);
921 d->locationEdit->lineEdit()->blockSignals(signalsBlocked);
928 d->differentHierarchyLevelItemsEntered =
false;
934 bool onlyDirectoryMode = directoryMode && !(mode &
KFile::File) && !(mode & KFile::Files);
936 bool filesInList =
false;
937 while (it != locationEditCurrentTextList.constEnd()) {
940 if (d->operationMode ==
Saving && !directoryMode) {
941 d->appendExtension(url);
957 i18n(
"You can only select local files"),
958 i18n(
"Remote files not accepted"));
967 while (it != locationEditCurrentTextList.constEnd()) {
972 KMessageBox::sorry(
this,
i18n(
"More than one folder has been selected and this dialog does not accept folders, so it is not possible to decide which one to enter. Please select only one folder to list it."),
i18n(
"More than one folder provided"));
980 KMessageBox::information(
this,
i18n(
"At least one folder and one file has been selected. Selected files will be ignored and the selected folder will be listed"),
i18n(
"Files and folders selected"));
982 d->ops->setUrl(url,
true);
983 const bool signalsBlocked = d->locationEdit->lineEdit()->blockSignals(
true);
984 d->locationEdit->lineEdit()->setText(
QString());
985 d->locationEdit->lineEdit()->blockSignals(signalsBlocked);
999 if ((d->operationMode ==
Saving) && d->confirmOverwrite && !d->toOverwrite(url)) {
1015 *lastDirectory = d->ops->url();
1016 if (!d->fileClass.isEmpty())
1020 d->locationEdit->setItemText( 0,
QString() );
1024 int atmost = d->locationEdit->maxItems();
1025 for ( ; it != list.
end() && atmost > 0; ++it ) {
1026 const KUrl& url = *it;
1033 for (
int i = 1; i < d->locationEdit->count(); i++ ) {
1034 if ( d->locationEdit->itemText( i ) == file ) {
1035 d->locationEdit->removeItem( i-- );
1042 d->locationEdit->insertItem( 1,file);
1046 d->writeViewConfig();
1047 d->saveRecentFiles();
1049 d->addToRecentDocuments();
1060 void KFileWidgetPrivate::_k_fileHighlighted(
const KFileItem &i)
1063 (locationEdit->hasFocus() && !locationEdit->currentText().isEmpty()))
1066 const bool modified = locationEdit->lineEdit()->isModified();
1071 setLocationText(
KUrl());
1078 if (!locationEdit->hasFocus()) {
1079 setLocationText( url );
1082 emit q->fileHighlighted(url.url());
1083 emit q->fileHighlighted(url);
1085 multiSelectionChanged();
1086 emit q->selectionChanged();
1089 locationEdit->lineEdit()->setModified(
false );
1090 locationEdit->lineEdit()->selectAll();
1093 void KFileWidgetPrivate::_k_fileSelected(
const KFileItem &i)
1101 setLocationText(
KUrl());
1104 setLocationText(i.
url());
1106 multiSelectionChanged();
1107 emit q->selectionChanged();
1113 locationEdit->setFocus();
1122 void KFileWidgetPrivate::multiSelectionChanged()
1124 if (locationEdit->hasFocus() && !locationEdit->currentText().isEmpty()) {
1131 setLocationText(
KUrl());
1135 setLocationText(list.
urlList());
1138 void KFileWidgetPrivate::setDummyHistoryEntry(
const QString& text,
const QPixmap& icon,
1139 bool usePreviousPixmapIfNull )
1145 q, SLOT(_k_slotLocationChanged(
QString)) );
1147 bool dummyExists = dummyAdded;
1149 int cursorPosition = locationEdit->lineEdit()->cursorPosition();
1153 locationEdit->setItemIcon( 0, icon );
1154 locationEdit->setItemText( 0, text );
1156 if ( !usePreviousPixmapIfNull ) {
1157 locationEdit->setItemIcon( 0,
QPixmap() );
1159 locationEdit->setItemText( 0, text );
1164 locationEdit->insertItem( 0, icon, text );
1166 if ( !usePreviousPixmapIfNull ) {
1167 locationEdit->insertItem( 0,
QPixmap(), text );
1169 locationEdit->insertItem( 0, text );
1177 if ( dummyExists && !text.
isEmpty() ) {
1178 locationEdit->setCurrentIndex( 0 );
1181 locationEdit->lineEdit()->setCursorPosition( cursorPosition );
1184 q, SLOT(_k_slotLocationChanged(
QString)) );
1187 void KFileWidgetPrivate::removeDummyHistoryEntry()
1189 if ( !dummyAdded ) {
1197 q, SLOT(_k_slotLocationChanged(
QString)) );
1199 if (locationEdit->count()) {
1200 locationEdit->removeItem( 0 );
1202 locationEdit->setCurrentIndex( -1 );
1206 q, SLOT(_k_slotLocationChanged(
QString)) );
1209 void KFileWidgetPrivate::setLocationText(
const KUrl& url)
1218 q->setUrl(u,
false);
1221 q->setUrl(url.
path(),
false);
1224 setDummyHistoryEntry(url.
fileName() , mimeTypeIcon);
1226 removeDummyHistoryEntry();
1231 setNonExtSelection();
1245 relPath = relPath.
mid(2);
1253 void KFileWidgetPrivate::setLocationText(
const KUrl::List& urlList )
1255 const KUrl currUrl = ops->
url();
1257 if ( urlList.
count() > 1 ) {
1259 foreach (
const KUrl &url, urlList) {
1262 urls = urls.
left( urls.
size() - 1 );
1264 setDummyHistoryEntry( urls,
QPixmap(),
false );
1265 }
else if ( urlList.
count() == 1 ) {
1269 removeDummyHistoryEntry();
1274 setNonExtSelection();
1277 void KFileWidgetPrivate::updateLocationWhatsThis()
1282 whatsThisText =
"<qt>" +
i18n(
"This is the name to save the file as.") +
1283 i18n (autocompletionWhatsThisText);
1287 whatsThisText =
"<qt>" +
i18n(
"This is the list of files to open. More than "
1288 "one file can be specified by listing several "
1289 "files, separated by spaces.") +
1290 i18n (autocompletionWhatsThisText);
1294 whatsThisText =
"<qt>" +
i18n(
"This is the name of the file to open.") +
1295 i18n (autocompletionWhatsThisText);
1298 locationLabel->setWhatsThis(whatsThisText);
1299 locationEdit->setWhatsThis(whatsThisText);
1302 void KFileWidgetPrivate::initSpeedbar()
1309 placesDock->setFeatures(QDockWidget::DockWidgetClosable);
1312 placesView->setModel(model);
1313 placesView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
1317 q, SLOT(_k_enterUrl(
KUrl)));
1323 placesView->setUrl(url);
1325 placesDock->setWidget(placesView);
1326 placesViewSplitter->insertWidget(0, placesDock);
1329 placesViewWidth = configGroup.readEntry(SpeedbarWidth, placesView->sizeHint().width());
1331 QList<int> sizes = placesViewSplitter->sizes();
1332 if (placesViewWidth > 0) {
1333 sizes[0] = placesViewWidth + 1;
1334 sizes[1] = q->width() - placesViewWidth -1;
1335 placesViewSplitter->setSizes(sizes);
1339 q, SLOT(_k_toggleSpeedbar(
bool)));
1342 void KFileWidgetPrivate::initGUI()
1347 boxLayout->setMargin(0);
1350 placesViewSplitter->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
1351 placesViewSplitter->setChildrenCollapsible(
false);
1352 boxLayout->addWidget(placesViewSplitter);
1355 q, SLOT(_k_placesViewSplitterMoved(
int,
int)));
1356 placesViewSplitter->insertWidget(0, opsWidget);
1360 boxLayout->addLayout(vbox);
1364 lafBox->addWidget(locationLabel, 0, 0, Qt::AlignVCenter | Qt::AlignRight);
1365 lafBox->addWidget(locationEdit, 0, 1, Qt::AlignVCenter);
1366 lafBox->addWidget(okButton, 0, 2, Qt::AlignVCenter);
1368 lafBox->addWidget(filterLabel, 1, 0, Qt::AlignVCenter | Qt::AlignRight);
1369 lafBox->addWidget(filterWidget, 1, 1, Qt::AlignVCenter);
1370 lafBox->addWidget(cancelButton, 1, 2, Qt::AlignVCenter);
1372 lafBox->setColumnStretch(1, 4);
1374 vbox->addLayout(lafBox);
1377 vbox->addWidget(autoSelectExtCheckBox);
1379 q->setTabOrder(ops, autoSelectExtCheckBox);
1380 q->setTabOrder(autoSelectExtCheckBox, locationEdit);
1381 q->setTabOrder(locationEdit, filterWidget);
1382 q->setTabOrder(filterWidget, okButton);
1383 q->setTabOrder(okButton, cancelButton);
1384 q->setTabOrder(cancelButton, urlNavigator);
1385 q->setTabOrder(urlNavigator, ops);
1386 q->setTabOrder(cancelButton, urlNavigator);
1387 q->setTabOrder(urlNavigator, ops);
1391 void KFileWidgetPrivate::_k_slotFilterChanged()
1395 filterDelayTimer.stop();
1402 types.
prepend(
"inode/directory");
1403 ops->setMimeFilter( types );
1406 ops->setNameFilter( filter );
1409 ops->setNameFilter(
'*' + filter.
replace(
' ',
'*') +
'*');
1414 updateAutoSelectExtension();
1416 emit q->filterChanged(filter);
1424 d->ops->setUrl(url, clearforward);
1428 void KFileWidgetPrivate::_k_urlEntered(
const KUrl& url)
1432 QString filename = locationEditCurrentText();
1435 if (pathCombo->
count() != 0) {
1439 bool blocked = locationEdit->blockSignals(
true);
1441 locationEdit->changeUrl(0,
KIcon(KMimeType::iconNameForUrl(filename)), filename);
1442 locationEdit->lineEdit()->setModified(
true);
1445 locationEdit->blockSignals( blocked );
1447 urlNavigator->setLocationUrl(url);
1452 completion->setDir( url.
path() );
1456 placesView->setUrl( url );
1460 void KFileWidgetPrivate::_k_locationAccepted(
const QString &url)
1467 void KFileWidgetPrivate::_k_enterUrl(
const KUrl& url )
1471 KUrl fixedUrl( url );
1475 q->setUrl( fixedUrl );
1476 if (!locationEdit->hasFocus())
1480 void KFileWidgetPrivate::_k_enterUrl(
const QString& url )
1484 _k_enterUrl(
KUrl( KUrlCompletion::replacedPath( url,
true,
true )) );
1487 bool KFileWidgetPrivate::toOverwrite(
const KUrl &url)
1496 i18n(
"The file \"%1\" already exists. Do you wish to overwrite it?" ,
1517 KUrl u = d->getCompleteUrl(url);
1519 kWarning() << url <<
" is not a correct argument for setSelection!";
1527 d->setLocationText(url);
1530 void KFileWidgetPrivate::_k_slotLoadingFinished()
1532 if (locationEdit->currentText().isEmpty()) {
1536 ops->blockSignals(
true);
1540 ops->setCurrentItem(url.
url());
1541 ops->blockSignals(
false);
1544 void KFileWidgetPrivate::_k_fileCompletion(
const QString& match )
1548 if (match.
isEmpty() || locationEdit->currentText().contains(
'"')) {
1555 void KFileWidgetPrivate::_k_slotLocationChanged(
const QString& text )
1559 locationEdit->lineEdit()->setModified(
true);
1561 if (text.
isEmpty() && ops->view()) {
1562 ops->view()->clearSelection();
1566 removeDummyHistoryEntry();
1568 setDummyHistoryEntry( text );
1571 if (!locationEdit->lineEdit()->text().isEmpty()) {
1574 foreach (
const KUrl &url, urlList) {
1575 stringList << url.
url();
1577 ops->setCurrentItems(stringList);
1598 if ( d->inAccept ) {
1600 list = d->parseSelectedUrls();
1608 KUrl::List& KFileWidgetPrivate::parseSelectedUrls()
1612 if ( filenames.isEmpty() ) {
1617 if ( filenames.contains(
'/' )) {
1628 i18n(
"The chosen filenames do not\n"
1629 "appear to be valid."),
1630 i18n(
"Invalid Filenames") );
1634 urlList = tokenize( filenames );
1648 KUrl u( ops->url() );
1666 int index1 = -1, index2 = -1;
1668 index1 = line.
indexOf(
'"', start );
1669 index2 = line.
indexOf(
'"', index1 + 1 );
1671 if ( index1 < 0 || index2 < 0 )
1675 name = line.
mid( index1 + 1, index2 - index1 - 1 );
1679 KUrl currUrl( name );
1682 _u.setFileName( name );
1689 if ( _u.isValid() ) {
1704 if ( d->inAccept ) {
1705 const KUrl url = d->mostLocalUrl(d->url);
1710 i18n(
"You can only select local files."),
1711 i18n(
"Remote Files Not Accepted") );
1725 const KUrl::List urls = d->parseSelectedUrls();
1727 while (it != urls.
end()) {
1728 KUrl url = d->mostLocalUrl(*it);
1736 if ( d->url.isLocalFile() )
1737 list.
append( d->url.toLocalFile() );
1746 return d->ops->url();
1753 if (d->placesDock) {
1756 QList<int> sizes = d->placesViewSplitter->sizes();
1757 sizes[0] = d->placesViewWidth + 1;
1758 sizes[1] =
width() - d->placesViewWidth - 1;
1759 d->placesViewSplitter->setSizes( sizes );
1765 if ( !d->hasView ) {
1769 d->ops->view()->setSizePolicy(
QSizePolicy( QSizePolicy::Maximum, QSizePolicy::Maximum ) );
1772 d->ops->clearHistory();
1782 if (watched == d->iconSizeSlider && keyEvent) {
1783 if (keyEvent->
key() == Qt::Key_Left || keyEvent->
key() == Qt::Key_Up ||
1784 keyEvent->
key() == Qt::Key_Right || keyEvent->
key() == Qt::Key_Down) {
1785 d->_k_slotIconSizeSliderMoved(d->iconSizeSlider->value());
1787 }
else if (watched == d->locationEdit && event->
type() == QEvent::KeyPress) {
1788 if (keyEvent->
modifiers() & Qt::AltModifier) {
1789 switch (keyEvent->
key()) {
1791 d->ops->actionCollection()->action(
"up")->trigger();
1794 d->ops->actionCollection()->action(
"back")->trigger();
1797 d->ops->actionCollection()->action(
"forward")->trigger();
1813 if ( d->ops->dirOnlyMode() ) {
1814 d->filterWidget->setDefaultFilter(
i18n(
"*|All Folders") );
1817 d->filterWidget->setDefaultFilter(
i18n(
"*|All Files") );
1820 d->updateAutoSelectExtension();
1825 return d->ops->mode();
1829 void KFileWidgetPrivate::readViewConfig()
1831 ops->setViewConfig(configGroup);
1832 ops->readConfig(configGroup);
1835 autoDirectoryFollowing = configGroup.readEntry(AutoDirectoryFollowing,
1836 DefaultDirectoryFollowing);
1839 configGroup.readEntry( PathComboCompletionMode,
1845 configGroup.readEntry( LocationComboCompletionMode,
1848 locationEdit->setCompletionMode( cm );
1851 _k_toggleSpeedbar( configGroup.readEntry( ShowSpeedbar,
true ) );
1854 _k_toggleBookmarks( configGroup.readEntry(ShowBookmarks,
false) );
1857 autoSelectExtChecked = configGroup.readEntry (AutoSelectExtChecked, DefaultAutoSelectExtChecked);
1858 updateAutoSelectExtension();
1861 urlNavigator->setUrlEditable( !configGroup.readEntry(BreadcrumbNavigation,
true) );
1864 urlNavigator->setShowFullPath( configGroup.readEntry(ShowFullPath,
false) );
1866 int w1 = q->minimumSize().width();
1867 int w2 = toolbar->sizeHint().width();
1869 q->setMinimumWidth(w2);
1872 void KFileWidgetPrivate::writeViewConfig()
1884 tmpGroup.writeEntry( PathComboCompletionMode, static_cast<int>(pathCombo->
completionMode()) );
1885 tmpGroup.writeEntry( LocationComboCompletionMode, static_cast<int>(locationEdit->completionMode()) );
1887 const bool showSpeedbar = placesDock && !placesDock->
isHidden();
1888 tmpGroup.writeEntry( ShowSpeedbar, showSpeedbar );
1890 const QList<int> sizes = placesViewSplitter->sizes();
1891 Q_ASSERT( sizes.
count() > 0 );
1892 tmpGroup.writeEntry( SpeedbarWidth, sizes[0] );
1895 tmpGroup.writeEntry( ShowBookmarks, bookmarkHandler != 0 );
1896 tmpGroup.writeEntry( AutoSelectExtChecked, autoSelectExtChecked );
1897 tmpGroup.writeEntry( BreadcrumbNavigation, !urlNavigator->isUrlEditable() );
1898 tmpGroup.writeEntry( ShowFullPath, urlNavigator->showFullPath() );
1900 ops->writeConfig( tmpGroup );
1903 tmpGroup.copyTo( &configGroup, KConfigGroup::Persistent | KConfigGroup::Global );
1907 void KFileWidgetPrivate::readRecentFiles()
1912 q, SLOT(_k_slotLocationChanged(
QString)));
1914 locationEdit->setMaxItems(configGroup.readEntry(RecentFilesNumber, DefaultRecentURLsNumber));
1915 locationEdit->setUrls(configGroup.readPathEntry(RecentFiles,
QStringList()),
1917 locationEdit->setCurrentIndex(-1);
1920 q, SLOT(_k_slotLocationChanged(
QString)));
1924 combo->
setMaxItems(configGroup.readEntry(RecentURLsNumber, DefaultRecentURLsNumber));
1925 combo->
setUrl(ops->url());
1930 completion->setDir(ops->url().url());
1935 void KFileWidgetPrivate::saveRecentFiles()
1938 configGroup.writePathEntry(RecentFiles, locationEdit->urls());
1941 configGroup.writePathEntry(RecentURLs, pathCombo->
urls());
1951 return d->cancelButton;
1961 d->writeViewConfig();
1966 d->keepLocation = keep;
1971 return d->keepLocation;
1978 d->operationMode =
mode;
1979 d->keepLocation = (mode ==
Saving);
1980 d->filterWidget->setEditable( !d->hasDefaultFilter || mode !=
Saving );
1983 d->okButton->setGuiItem(
KGuiItem(
i18n(
"&Open" ),
"document-open") );
1986 }
else if ( mode ==
Saving ) {
1988 d->setNonExtSelection();
1992 d->updateLocationWhatsThis();
1993 d->updateAutoSelectExtension();
1996 d->ops->setIsSaving(mode ==
Saving);
2002 return d->operationMode;
2005 void KFileWidgetPrivate::_k_slotAutoSelectExtClicked()
2011 autoSelectExtChecked = autoSelectExtCheckBox->isChecked();
2014 updateLocationEditExtension (extension );
2017 void KFileWidgetPrivate::_k_placesViewSplitterMoved(
int pos,
int index)
2023 if (placesDock && index == 1) {
2024 placesViewWidth = pos;
2026 lafBox->setColumnMinimumWidth(0, placesViewWidth);
2030 void KFileWidgetPrivate::_k_activateUrlNavigator()
2034 urlNavigator->setUrlEditable(!urlNavigator->isUrlEditable());
2035 if(urlNavigator->isUrlEditable()) {
2036 urlNavigator->setFocus();
2037 urlNavigator->editor()->lineEdit()->selectAll();
2041 void KFileWidgetPrivate::_k_zoomOutIconsSize()
2043 const int currValue = ops->iconsZoom();
2044 const int futValue = qMax(0, currValue - 10);
2045 iconSizeSlider->setValue(futValue);
2046 _k_slotIconSizeSliderMoved(futValue);
2049 void KFileWidgetPrivate::_k_zoomInIconsSize()
2051 const int currValue = ops->iconsZoom();
2052 const int futValue = qMin(100, currValue + 10);
2053 iconSizeSlider->setValue(futValue);
2054 _k_slotIconSizeSliderMoved(futValue);
2057 void KFileWidgetPrivate::_k_slotIconSizeChanged(
int _value)
2060 int value = (maxSize * _value / 100) + KIconLoader::SizeSmall;
2062 case KIconLoader::SizeSmall:
2068 iconSizeSlider->setToolTip(
i18n(
"Icon size: %1 pixels (standard size)", value));
2071 iconSizeSlider->setToolTip(
i18n(
"Icon size: %1 pixels", value));
2076 void KFileWidgetPrivate::_k_slotIconSizeSliderMoved(
int _value)
2080 _k_slotIconSizeChanged(_value);
2082 QPoint global(iconSizeSlider->rect().topLeft());
2083 global.
ry() += iconSizeSlider->height() / 2;
2084 QHelpEvent toolTipEvent(QEvent::ToolTip,
QPoint(0, 0), iconSizeSlider->mapToGlobal(global));
2097 it != patternListEnd;
2110 (*it).length() > 2 &&
2111 (*it).indexOf(
'*', 2) < 0 && (*it).indexOf (
'?', 2) < 0)
2113 ret = (*it).
mid (1);
2137 void KFileWidgetPrivate::updateAutoSelectExtension()
2139 if (!autoSelectExtCheckBox)
return;
2149 QString lastExtension = extension;
2159 QString filter = filterWidget->currentFilter();
2165 QString currentExtension = KMimeType::extractKnownExtension(locationEditCurrentText());
2166 if ( currentExtension.
isEmpty() )
2168 kDebug (kfile_area) <<
"filter:" << filter <<
"locationEdit:" << locationEditCurrentText()
2169 <<
"currentExtension:" << currentExtension;
2177 extensionList = filter.
split(
' ', QString::SkipEmptyParts);
2183 KMimeType::Ptr mime = KMimeType::mimeType (filter);
2186 extensionList = mime->patterns();
2187 defaultExtension = mime->mainExtension();
2191 if ( !currentExtension.isEmpty() && extensionList.
contains(
QLatin1String(
"*.") + currentExtension) )
2194 extension = defaultExtension;
2196 kDebug (kfile_area) <<
"List:" << extensionList <<
"auto-selected extension:" << extension;
2205 if (!extension.isEmpty())
2208 autoSelectExtCheckBox->setText (i18n (
"Automatically select filename e&xtension (%1)", extension));
2209 whatsThisExtension =
i18n (
"the extension <b>%1</b>", extension);
2211 autoSelectExtCheckBox->setEnabled (
true);
2212 autoSelectExtCheckBox->setChecked (autoSelectExtChecked);
2217 autoSelectExtCheckBox->setText (i18n (
"Automatically select filename e&xtension"));
2218 whatsThisExtension =
i18n (
"a suitable extension");
2220 autoSelectExtCheckBox->setChecked (
false);
2221 autoSelectExtCheckBox->setEnabled (
false);
2226 autoSelectExtCheckBox->setWhatsThis(
"<qt>" +
2228 "This option enables some convenient features for "
2229 "saving files with extensions:<br />"
2231 "<li>Any extension specified in the <b>%1</b> text "
2232 "area will be updated if you change the file type "
2235 "<li>If no extension is specified in the <b>%2</b> "
2236 "text area when you click "
2237 "<b>Save</b>, %3 will be added to the end of the "
2238 "filename (if the filename does not already exist). "
2239 "This extension is based on the file type that you "
2240 "have chosen to save in.<br />"
2242 "If you do not want KDE to supply an extension for the "
2243 "filename, you can either turn this option off or you "
2244 "can suppress it by adding a period (.) to the end of "
2245 "the filename (the period will be automatically "
2249 "If unsure, keep this option enabled as it makes your "
2250 "files more manageable."
2258 autoSelectExtCheckBox->show();
2262 updateLocationEditExtension (lastExtension);
2267 autoSelectExtCheckBox->setChecked (
false);
2268 autoSelectExtCheckBox->hide();
2275 void KFileWidgetPrivate::updateLocationEditExtension (
const QString &lastExtension)
2277 if (!autoSelectExtCheckBox->isChecked() || extension.isEmpty())
2280 QString urlStr = locationEditCurrentText();
2284 KUrl url = getCompleteUrl(urlStr);
2287 const int fileNameOffset = urlStr.
lastIndexOf (
'/') + 1;
2288 QString fileName = urlStr.
mid (fileNameOffset);
2291 const int len = fileName.
length();
2321 else if (extension.length() && fileName.
endsWith (extension))
2322 fileName.
truncate (len - extension.length());
2328 const QString newText = urlStr.
left (fileNameOffset) + fileName + extension;
2329 if ( newText != locationEditCurrentText() )
2331 locationEdit->setItemText(locationEdit->currentIndex(),urlStr.
left (fileNameOffset) + fileName + extension);
2332 locationEdit->lineEdit()->setModified (
true);
2339 void KFileWidgetPrivate::updateFilter()
2344 QString urlStr = locationEditCurrentText();
2348 if( filterWidget->isMimeFilter()) {
2349 KMimeType::Ptr mime = KMimeType::findByPath(urlStr, 0,
true);
2350 if (mime && mime->name() != KMimeType::defaultMimeType()) {
2351 if (filterWidget->currentFilter() != mime->name() &&
2352 filterWidget->filters().indexOf(mime->name()) != -1)
2353 filterWidget->setCurrentFilter(mime->name());
2357 foreach(
const QString& filter, filterWidget->filters()) {
2359 foreach (
const QString& p, patterns ) {
2360 if( KMimeType::matchFileName( filename, p )) {
2362 filterWidget->setCurrentFilter( filter );
2373 void KFileWidgetPrivate::appendExtension (
KUrl &url)
2377 if (!autoSelectExtCheckBox->isChecked() || extension.isEmpty())
2386 const int len = fileName.
length();
2389 const bool suppressExtension = (dot == len - 1);
2390 const bool unspecifiedExtension = (dot <= 0);
2393 if (!(suppressExtension || unspecifiedExtension))
2406 if (suppressExtension)
2422 else if (unspecifiedExtension)
2432 void KFileWidgetPrivate::addToRecentDocuments()
2434 int m = ops->mode();
2441 for ( ; it != files.
end() && atmost > 0; ++it ) {
2450 for ( ; it != urls.
end() && atmost > 0; ++it ) {
2451 if ( (*it).isValid() ) {
2461 return d->locationEdit;
2466 return d->filterWidget;
2471 return d->ops->actionCollection();
2474 void KFileWidgetPrivate::_k_toggleSpeedbar(
bool show)
2479 lafBox->setColumnMinimumWidth(0, placesViewWidth);
2485 for (
int rowIndex = 0 ; rowIndex < model->
rowCount() ; rowIndex++) {
2490 toolbar->removeAction( ops->actionCollection()->action(
"home" ) );
2495 if (q->sender() == placesDock && placesDock && placesDock->isVisibleTo(q)) {
2505 QAction* homeAction = ops->actionCollection()->action(
"home");
2506 QAction* reloadAction = ops->actionCollection()->action(
"reload");
2507 if (!toolbar->actions().contains(homeAction)) {
2508 toolbar->insertAction(reloadAction, homeAction);
2512 lafBox->setColumnMinimumWidth(0, 0);
2515 static_cast<KToggleAction *
>(q->actionCollection()->action(
"toggleSpeedbar"))->setChecked(show);
2518 urlNavigator->setPlacesSelectorVisible(!show);
2521 void KFileWidgetPrivate::_k_toggleBookmarks(
bool show)
2525 if (bookmarkHandler)
2531 q->connect( bookmarkHandler, SIGNAL(openUrl(
QString)),
2535 bookmarkButton->setDelayed(
false);
2536 q->actionCollection()->addAction(
"bookmark", bookmarkButton);
2537 bookmarkButton->setMenu(bookmarkHandler->menu());
2538 bookmarkButton->setWhatsThis(
i18n(
"<qt>This button allows you to bookmark specific locations. "
2539 "Click on this button to open the bookmark menu where you may add, "
2540 "edit or select a bookmark.<br /><br />"
2541 "These bookmarks are specific to the file dialog, but otherwise operate "
2542 "like bookmarks elsewhere in KDE.</qt>"));
2543 toolbar->addAction(bookmarkButton);
2545 else if (bookmarkHandler)
2547 delete bookmarkHandler;
2548 bookmarkHandler = 0;
2549 delete bookmarkButton;
2553 static_cast<KToggleAction *
>(q->actionCollection()->action(
"toggleBookmarks"))->setChecked( show );
2562 return getStartUrl( startDir, recentDirClass, fileName );
2571 recentDirClass.
clear();
2575 bool useDefaultStartDir = startDir.
isEmpty();
2576 if ( !useDefaultStartDir )
2578 if ( startDir.
protocol() ==
"kfiledialog" )
2593 if ( urlDir ==
"/" )
2600 keyword = urlDir.
mid( 1 );
2604 if ( startDir.
query() ==
"?global" )
2605 recentDirClass =
QString(
"::%1" ).
arg( keyword );
2607 recentDirClass =
QString(
":%1" ).
arg( keyword );
2626 useDefaultStartDir =
true;
2633 useDefaultStartDir =
true;
2638 if ( useDefaultStartDir )
2640 if (lastDirectory->isEmpty()) {
2653 ret = *lastDirectory;
2656 kDebug(
kfile_area) <<
"for" << startDir <<
"->" << ret <<
"recentDirClass" << recentDirClass <<
"fileName" << fileName;
2663 *lastDirectory = directory;
2666 void KFileWidgetPrivate::setNonExtSelection()
2669 QString filename = locationEditCurrentText();
2670 QString extension = KMimeType::extractKnownExtension( filename );
2673 locationEdit->lineEdit()->setSelection( 0, filename.
length() - extension.
length() - 1 );
2678 locationEdit->lineEdit()->setSelection( 0, lastDot );
2689 delete d->bottomCustomWidget;
2690 d->bottomCustomWidget = widget;
2695 d->bottomCustomWidget->setParent(
this );
2697 d->vbox->addWidget( d->bottomCustomWidget );
2705 setTabOrder(d->cancelButton, d->bottomCustomWidget);
2706 setTabOrder(d->bottomCustomWidget, d->urlNavigator);
2711 delete d->labeledCustomWidget;
2712 d->labeledCustomWidget = widget;
2716 d->lafBox->addWidget(label, 2, 0, Qt::AlignVCenter);
2717 d->lafBox->addWidget(widget, 2, 1, Qt::AlignVCenter);
2729 bool *enable =
static_cast<bool*
>(data);
2730 d->confirmOverwrite = *enable;
2734 bool *show =
static_cast<bool*
>(data);
2735 d->setInlinePreviewShown(*show);
2750 d->configGroup = group;
2751 d->readViewConfig();
2752 d->readRecentFiles();
2755 QString KFileWidgetPrivate::locationEditCurrentText()
const
2760 KUrl KFileWidgetPrivate::mostLocalUrl(
const KUrl &url)
2783 void KFileWidgetPrivate::setInlinePreviewShown(
bool show)
2785 ops->setInlinePreviewShown(show);
2789 #include "kfilewidget.moc"
KUrl url(const QModelIndex &index) const
QString i18n(const char *text)
void adjustPath(AdjustPathOption trailing)
int indexOf(QChar ch, int from, Qt::CaseSensitivity cs) const
Qt::KeyboardModifiers modifiers() const
QString directory(const DirectoryOptions &options=IgnoreTrailingSlash) const
static QString relativeUrl(const KUrl &base_url, const KUrl &url)
void truncate(int position)
void setSeparator(bool b)
static QString relativePath(const QString &base_dir, const QString &path, bool *isParent=0)
virtual void setCompletionObject(KCompletion *compObj, bool hsig=true)
QString fromNativeSeparators(const QString &pathName)
Generates previews for files of an item view.
static KIconLoader * global()
void setText(const QString &)
static bool isKnownProtocol(const KUrl &url)
static QString desktopPath()
KAction * copy(const QObject *recvr, const char *slot, QObject *parent)
QStringList split(const QString &sep, SplitBehavior behavior, Qt::CaseSensitivity cs) const
QString label(StandardShortcut id)
static void information(QWidget *parent, const QString &text, const QString &caption=QString(), const QString &dontShowAgainName=QString(), Options options=Notify)
This class allows to display a KFilePlacesModel.
Note: Ported to new KBookmarkMenu, but untested.
bool contains(const QString &str, Qt::CaseSensitivity cs) const
const char * name(StandardAction id)
void add(const QString &fileClass, const QString &directory)
static bool synchronousRun(Job *job, QWidget *window, QByteArray *data=0, KUrl *finalURL=0, QMap< QString, QString > *metaData=0)
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const
Get the children model index for the given row and column.
StatJob * stat(const KUrl &url, JobFlags flags=DefaultFlags)
void setAlignment(QFlags< Qt::AlignmentFlag >)
QAction * addAction(const QString &name, QAction *action)
QString toLocalFile(AdjustPathOption trailing=LeaveTrailingSlash) const
QPixmap pixmapForUrl(const KUrl &_url, mode_t _mode=0, KIconLoader::Group _group=KIconLoader::Desktop, int _force_size=0, int _state=0, QString *_path=0)
QString join(const QString &separator) const
QString & remove(int position, int n)
static void add(const KUrl &url)
StatJob * mostLocalUrl(const KUrl &url, JobFlags flags=DefaultFlags)
static QDebug kDebug(bool cond, int area=KDE_DEFAULT_DEBUG_AREA)
bool isParentOf(const KUrl &u) const
bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *method)
int rowCount(const QModelIndex &parent=QModelIndex()) const
Get the number of rows for a model index.
QString i18nc(const char *ctxt, const char *text)
void setUrls(const QStringList &urls)
KSharedConfigPtr config()
int lastIndexOf(QChar ch, int from, Qt::CaseSensitivity cs) const
void setPath(const QString &path)
void addPath(const QString &txt)
int count(const T &value) const
void append(const T &value)
void addDefaultUrl(const KUrl &url, const QString &text=QString())
bool authorizeUrlAction(const QString &action, const KUrl &baseUrl, const KUrl &destUrl)
This widget works as a network transparent filebrowser.
static void sorry(QWidget *parent, const QString &text, const QString &caption=QString(), Options options=Notify)
QString buildErrorString(int errorCode, const QString &errorText)
virtual void setCompletionMode(KGlobalSettings::Completion mode)
bool sendEvent(QObject *receiver, QEvent *event)
bool startsWith(const QString &s, Qt::CaseSensitivity cs) const
QString pathOrUrl() const
QPixmap loadMimeTypeIcon(const QString &iconName, KIconLoader::Group group, int size=0, int state=KIconLoader::DefaultState, const QStringList &overlays=QStringList(), QString *path_store=0) const
QString stringValue(uint field) const
KAction * home(const QObject *recvr, const char *slot, QObject *parent)
bool endsWith(const QString &s, Qt::CaseSensitivity cs) const
virtual bool eventFilter(QObject *watched, QEvent *event)
void setAutoDeleteCompletionObject(bool autoDelete)
QString path(AdjustPathOption trailing=LeaveTrailingSlash) const
void removeAction(QAction *action)
void setMargin(int margin)
bool signalsBlocked() const
void setWhatsThis(const QString &what)
QStringList types(Mode mode=Writing)
void setShortcut(const KShortcut &shortcut, ShortcutTypes type=ShortcutTypes(ActiveShortcut|DefaultShortcut))
static QString documentPath()
bool contains(QChar ch, Qt::CaseSensitivity cs) const
void setShortcut(const QKeySequence &shortcut)
bool isPreviewShown() const
QString removeAcceleratorMarker(const QString &label) const
QString & replace(int position, int n, QChar after)
void setFileName(const QString &_txt)
bool isAbsolutePath(const QString &path)
QString mid(int position, int n) const
QString dir(const QString &fileClass)
QString fileName(const DirectoryOptions &options=IgnoreTrailingSlash) const
void setUrl(const KUrl &url)
void addAssociatedWidget(QWidget *widget)
QString tildeExpand(const QString &path)
static QDebug kWarning(bool cond, int area=KDE_DEFAULT_DEBUG_AREA)
QString section(QChar sep, int start, int end, QFlags< QString::SectionFlag > flags) const
QString left(int n) const
QAction * action(int index) const
void prepend(const T &value)
QString url(AdjustPathOption trailing=LeaveTrailingSlash) const
QFuture< void > filter(Sequence &sequence, FilterFunction filterFunction)
Widget that allows to navigate through the paths of an URL.
static bool supportsListing(const KUrl &url)
static Completion completionMode()
const UDSEntry & statResult() const
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
static int maximumItems()
QString arg(qlonglong a, int fieldWidth, int base, const QChar &fillChar) const
bool equals(const KUrl &u, const EqualsOptions &options=0) const
const KShortcut & completion()
static int warningContinueCancel(QWidget *parent, const QString &text, const QString &caption=QString(), const KGuiItem &buttonContinue=KStandardGuiItem::cont(), const KGuiItem &buttonCancel=KStandardGuiItem::cancel(), const QString &dontAskAgainName=QString(), Options options=Notify)
QString prettyUrl(AdjustPathOption trailing=LeaveTrailingSlash) const
KUrl::List urlList() const
KGlobalSettings::Completion completionMode() const
void setSpacing(int spacing)
static void error(QWidget *parent, const QString &text, const QString &caption=QString(), Options options=Notify)
QStringList list(const QString &fileClass)
This class is a list view model.