KFile
kurlnavigator.h
Go to the documentation of this file.
00001 /***************************************************************************** 00002 * Copyright (C) 2006-2010 by Peter Penz <peter.penz@gmx.at> * 00003 * Copyright (C) 2006 by Aaron J. Seigo <aseigo@kde.org> * 00004 * Copyright (C) 2007 by Kevin Ottens <ervin@kde.org> * 00005 * Copyright (C) 2007 by Urs Wolfer <uwolfer @ kde.org> * 00006 * * 00007 * This library is free software; you can redistribute it and/or * 00008 * modify it under the terms of the GNU Library General Public * 00009 * License as published by the Free Software Foundation; either * 00010 * version 2 of the License, or (at your option) any later version. * 00011 * * 00012 * This library is distributed in the hope that it will be useful, * 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00015 * Library General Public License for more details. * 00016 * * 00017 * You should have received a copy of the GNU Library General Public License * 00018 * along with this library; see the file COPYING.LIB. If not, write to * 00019 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * 00020 * Boston, MA 02110-1301, USA. * 00021 *****************************************************************************/ 00022 00023 #ifndef KURLNAVIGATOR_H 00024 #define KURLNAVIGATOR_H 00025 00026 #include <kfile_export.h> 00027 00028 #include <kurl.h> 00029 #include <QtGui/QWidget> 00030 #include <QtCore/QByteArray> 00031 00032 class KFilePlacesModel; 00033 class KUrlComboBox; 00034 class QMouseEvent; 00035 00075 class KFILE_EXPORT KUrlNavigator : public QWidget 00076 { 00077 Q_OBJECT 00078 00079 public: 00081 KUrlNavigator(QWidget* parent = 0); 00082 00090 KUrlNavigator(KFilePlacesModel* placesModel, const KUrl& url, QWidget* parent); 00091 virtual ~KUrlNavigator(); 00092 00098 KUrl locationUrl(int historyIndex = -1) const; 00099 00120 void saveLocationState(const QByteArray& state); 00121 00128 QByteArray locationState(int historyIndex = -1) const; 00129 00138 bool goBack(); 00139 00148 bool goForward(); 00149 00157 bool goUp(); 00158 00166 // KDE5: Remove the home-property. It is sufficient to invoke 00167 // KUrlNavigator::setLocationUrl(homeUrl) on application-side. 00168 void goHome(); 00169 00175 // KDE5: Remove the home-property. It is sufficient to invoke 00176 // KUrlNavigator::setLocationUrl(homeUrl) on application-side. 00177 void setHomeUrl(const KUrl& url); 00178 00179 KUrl homeUrl() const; 00180 00187 void setUrlEditable(bool editable); 00188 00194 bool isUrlEditable() const; 00195 00205 void setShowFullPath(bool show); 00206 00211 bool showFullPath() const; 00212 00222 void setActive(bool active); 00223 00228 bool isActive() const; 00229 00236 void setPlacesSelectorVisible(bool visible); 00237 00239 bool isPlacesSelectorVisible() const; 00240 00245 KUrl uncommittedUrl() const; 00246 00252 int historySize() const; 00253 00259 int historyIndex() const; 00260 00265 KUrlComboBox* editor() const; 00266 00271 // KDE5: Think about removing the custom-protocols-property. It had been used 00272 // only by one application currently which uses a different approach now. 00273 void setCustomProtocols(const QStringList& protocols); 00274 00278 QStringList customProtocols() const; 00279 00280 #if !defined(KDE_NO_DEPRECATED) && !defined(DOXYGEN_SHOULD_SKIP_THIS) 00281 00285 KDE_DEPRECATED const KUrl& url() const; 00286 00297 KDE_DEPRECATED KUrl url(int index) const; 00298 00305 KDE_DEPRECATED KUrl historyUrl(int historyIndex) const; 00306 00311 KDE_DEPRECATED const KUrl& savedRootUrl() const; 00312 00318 KDE_DEPRECATED QPoint savedPosition() const; 00319 00321 KDE_DEPRECATED void setHomeUrl(const QString& homeUrl); 00322 #endif 00323 00324 public Q_SLOTS: 00332 void setLocationUrl(const KUrl& url); 00333 00339 void requestActivation(); 00340 00341 #if !defined(DOXYGEN_SHOULD_SKIP_THIS) 00342 // KDE5: Remove and listen for focus-signal instead 00343 void setFocus(); 00344 #endif 00345 00346 #if !defined(KDE_NO_DEPRECATED) && !defined(DOXYGEN_SHOULD_SKIP_THIS) 00347 00351 KDE_DEPRECATED void setUrl(const KUrl& url); 00352 00357 KDE_DEPRECATED void saveRootUrl(const KUrl& url); 00358 00363 KDE_DEPRECATED void savePosition(int x, int y); 00364 #endif 00365 00366 Q_SIGNALS: 00372 void activated(); 00373 00379 void urlChanged(const KUrl& url); 00380 00388 void urlAboutToBeChanged(const KUrl& newUrl); 00389 00394 void editableStateChanged(bool editable); 00395 00400 void historyChanged(); 00401 00408 void urlsDropped(const KUrl& destination, QDropEvent* event); 00409 00413 void returnPressed(); 00414 00420 void tabRequested(const KUrl& url); 00421 00422 #if !defined(KDE_NO_DEPRECATED) && !defined(DOXYGEN_SHOULD_SKIP_THIS) 00423 00430 // KDE5: remove, as the signal has been replaced by 00431 // urlsDropped(const KUrl& destination, QDropEvent* event) 00432 KDE_DEPRECATED void urlsDropped(const KUrl::List& urls, 00433 const KUrl& destination); 00434 #endif 00435 00436 protected: 00437 #if !defined(DOXYGEN_SHOULD_SKIP_THIS) 00438 00443 virtual void keyPressEvent(QKeyEvent* event); 00444 00448 virtual void keyReleaseEvent(QKeyEvent* event); 00449 00455 virtual void mouseReleaseEvent(QMouseEvent* event); 00456 00457 virtual void resizeEvent(QResizeEvent* event); 00458 00459 virtual void wheelEvent(QWheelEvent* event); 00460 00461 virtual bool eventFilter(QObject* watched, QEvent* event); 00462 #endif 00463 00464 private: 00465 Q_PRIVATE_SLOT(d, void slotReturnPressed()) 00466 Q_PRIVATE_SLOT(d, void slotProtocolChanged(const QString& protocol)) 00467 Q_PRIVATE_SLOT(d, void switchView()) 00468 Q_PRIVATE_SLOT(d, void dropUrls(const KUrl& destination, QDropEvent*)) 00469 Q_PRIVATE_SLOT(d, void slotNavigatorButtonClicked(const KUrl& url, Qt::MouseButton button)) 00470 Q_PRIVATE_SLOT(d, void openContextMenu()) 00471 Q_PRIVATE_SLOT(d, void openPathSelectorMenu()) 00472 Q_PRIVATE_SLOT(d, void updateButtonVisibility()) 00473 Q_PRIVATE_SLOT(d, void switchToBreadcrumbMode()) 00474 Q_PRIVATE_SLOT(d, void slotPathBoxChanged(const QString& text)) 00475 Q_PRIVATE_SLOT(d, void updateContent()) 00476 00477 private: 00478 class Private; 00479 Private* const d; 00480 00481 Q_DISABLE_COPY(KUrlNavigator) 00482 }; 00483 00484 #endif
KDE 4.7 API Reference