KFile
kfilewidget.h
Go to the documentation of this file.
00001 // -*- c++ -*- 00002 /* This file is part of the KDE libraries 00003 Copyright (C) 1997, 1998 Richard Moore <rich@kde.org> 00004 1998 Stephan Kulow <coolo@kde.org> 00005 1998 Daniel Grana <grana@ie.iwi.unibe.ch> 00006 2000,2001 Carsten Pfeiffer <pfeiffer@kde.org> 00007 2001 Frerich Raabe <raabe@kde.org> 00008 2007 David Faure <faure@kde.org> 00009 2008 Rafael Fernández López <ereslibre@kde.org> 00010 00011 This library is free software; you can redistribute it and/or 00012 modify it under the terms of the GNU Library General Public 00013 License as published by the Free Software Foundation; either 00014 version 2 of the License, or (at your option) any later version. 00015 00016 This library is distributed in the hope that it will be useful, 00017 but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00019 Library General Public License for more details. 00020 00021 You should have received a copy of the GNU Library General Public License 00022 along with this library; see the file COPYING.LIB. If not, write to 00023 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00024 Boston, MA 02110-1301, USA. 00025 */ 00026 00027 00028 #ifndef KFILEWIDGET_H 00029 #define KFILEWIDGET_H 00030 00031 #include "kfile_export.h" 00032 #include "kabstractfilewidget.h" 00033 #include <QtGui/QWidget> 00034 00035 class KJob; 00036 class KFileItem; 00037 class KDirOperator; 00038 00039 class KFILE_EXPORT KFileWidget : public QWidget, public KAbstractFileWidget 00040 { 00041 Q_OBJECT 00042 Q_INTERFACES(KAbstractFileWidget) 00043 public: 00074 KFileWidget(const KUrl& startDir, QWidget *parent); 00075 00079 virtual ~KFileWidget(); 00080 00084 virtual KUrl selectedUrl() const; 00085 00089 virtual KUrl::List selectedUrls() const; 00090 00094 virtual KUrl baseUrl() const; 00095 00100 virtual QString selectedFile() const; 00101 00105 virtual QStringList selectedFiles() const; 00106 00114 virtual void setUrl(const KUrl &url, bool clearforward = true); 00115 00121 virtual void setSelection(const QString& name); 00122 00140 virtual void setOperationMode( OperationMode ); 00141 00149 virtual OperationMode operationMode() const; 00150 00162 virtual void setKeepLocation( bool keep ); 00163 00168 virtual bool keepsLocation() const; 00169 00204 virtual void setFilter(const QString& filter); 00205 00213 virtual QString currentFilter() const; 00214 00223 virtual KMimeType::Ptr currentFilterMimeType(); 00224 00236 virtual void setMimeFilter( const QStringList& types, 00237 const QString& defaultType = QString() ); 00238 00247 virtual QString currentMimeFilter() const; 00248 00252 virtual void clearFilter(); 00253 00265 virtual void setPreviewWidget(KPreviewWidgetBase *w); 00266 00288 virtual void setMode( KFile::Modes m ); 00289 00294 virtual KFile::Modes mode() const; 00295 00303 virtual void setLocationLabel(const QString& text); 00304 00317 KToolBar *toolBar() const; 00318 00324 KPushButton *okButton() const; 00325 00331 KPushButton *cancelButton() const; 00332 00336 KUrlComboBox *locationEdit() const; 00337 00341 KFileFilterCombo *filterWidget() const; 00342 00347 KActionCollection *actionCollection() const; 00348 00365 static KUrl getStartUrl( const KUrl& startDir, QString& recentDirClass ); 00366 00387 static KUrl getStartUrl( const KUrl& startDir, QString& recentDirClass, QString& fileName ); 00388 00393 static void setStartDir( const KUrl& directory ); 00394 00403 virtual void setCustomWidget(QWidget* widget); 00404 00415 virtual void setCustomWidget(const QString& text, QWidget* widget); 00416 00418 virtual void virtual_hook( int id, void* data ); 00419 00420 public Q_SLOTS: 00425 virtual void slotOk(); 00426 virtual void accept(); 00427 virtual void slotCancel(); 00428 00429 protected: 00430 virtual void resizeEvent(QResizeEvent* event); 00431 virtual void showEvent(QShowEvent* event); 00432 virtual bool eventFilter(QObject* watched, QEvent* event); 00433 00434 Q_SIGNALS: 00444 void fileSelected(const KUrl&); 00445 00449 QT_MOC_COMPAT void fileSelected(const QString&); // TODO KDE5: remove 00450 00455 void fileHighlighted(const KUrl&); 00459 QT_MOC_COMPAT void fileHighlighted(const QString&); // TODO KDE5: remove 00460 00469 void selectionChanged(); 00470 00481 void filterChanged( const QString& filter ); 00482 00487 void accepted(); 00488 00489 public: 00494 KDirOperator* dirOperator(); 00495 00501 void readConfig( KConfigGroup& group ); 00502 00503 private: 00504 friend class KFileWidgetPrivate; 00505 KFileWidgetPrivate* const d; 00506 00507 Q_PRIVATE_SLOT(d, void _k_slotLocationChanged(const QString&)) 00508 Q_PRIVATE_SLOT(d, void _k_urlEntered(const KUrl&)) 00509 Q_PRIVATE_SLOT(d, void _k_enterUrl(const KUrl&)) 00510 Q_PRIVATE_SLOT(d, void _k_enterUrl(const QString&)) 00511 Q_PRIVATE_SLOT(d, void _k_locationAccepted(const QString&)) 00512 Q_PRIVATE_SLOT(d, void _k_slotFilterChanged()) 00513 Q_PRIVATE_SLOT(d, void _k_fileHighlighted(const KFileItem&)) 00514 Q_PRIVATE_SLOT(d, void _k_fileSelected(const KFileItem&)) 00515 Q_PRIVATE_SLOT(d, void _k_slotLoadingFinished()) 00516 Q_PRIVATE_SLOT(d, void _k_fileCompletion(const QString&)) 00517 Q_PRIVATE_SLOT(d, void _k_toggleSpeedbar(bool)) 00518 Q_PRIVATE_SLOT(d, void _k_toggleBookmarks(bool)) 00519 Q_PRIVATE_SLOT(d, void _k_slotAutoSelectExtClicked()) 00520 Q_PRIVATE_SLOT(d, void _k_placesViewSplitterMoved(int, int)) 00521 Q_PRIVATE_SLOT(d, void _k_activateUrlNavigator()) 00522 Q_PRIVATE_SLOT(d, void _k_zoomOutIconsSize()) 00523 Q_PRIVATE_SLOT(d, void _k_zoomInIconsSize()) 00524 Q_PRIVATE_SLOT(d, void _k_slotIconSizeSliderMoved(int)) 00525 Q_PRIVATE_SLOT(d, void _k_slotIconSizeChanged(int)) 00526 }; 00527 00528 #endif /* KABSTRACTFILEWIDGET_H */ 00529
KDE 4.6 API Reference