From kde-commits Mon Jan 10 21:37:38 2011 From: Peter Penz Date: Mon, 10 Jan 2011 21:37:38 +0000 To: kde-commits Subject: KDE/kdelibs/kfile Message-Id: <20110110213738.7E46FAC8B2 () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=129469551713609 SVN commit 1213578 by ppenz: - Move internal KUrlNavigator classes into the KDEPrivate namespace - Improve documentation for KUrlNavigator M +2 -0 kurlnavigator.cpp M +20 -26 kurlnavigator.h M +4 -0 kurlnavigatorbutton.cpp M +5 -0 kurlnavigatorbutton_p.h M +5 -0 kurlnavigatorbuttonbase.cpp M +5 -0 kurlnavigatorbuttonbase_p.h M +5 -1 kurlnavigatordropdownbutton.cpp M +5 -0 kurlnavigatordropdownbutton_p.h M +5 -0 kurlnavigatormenu.cpp M +7 -0 kurlnavigatormenu_p.h M +7 -4 kurlnavigatorplacesselector.cpp M +6 -0 kurlnavigatorplacesselector_p.h M +7 -1 kurlnavigatorprotocolcombo.cpp M +5 -0 kurlnavigatorprotocolcombo_p.h M +5 -0 kurlnavigatortogglebutton.cpp M +5 -0 kurlnavigatortogglebutton_p.h --- trunk/KDE/kdelibs/kfile/kurlnavigator.cpp #1213577:1213578 @@ -53,6 +53,8 @@ #include +using namespace KDEPrivate; + struct LocationData { KUrl url; --- trunk/KDE/kdelibs/kfile/kurlnavigator.h #1213577:1213578 @@ -37,9 +37,8 @@ * @brief Widget that allows to navigate through the paths of an URL. * * The URL navigator offers two modes: - * - Editable: Represents the 'classic' mode, where the URL of the location - * is editable inside a line editor. By pressing RETURN - * the URL will get activated. + * - Editable: The URL of the location is editable inside an editor. + * By pressing RETURN the URL will get activated. * - Non editable ("breadcrumb view"): The URL of the location is represented by * a number of buttons, where each button represents a path * of the URL. By clicking on a button the path will get @@ -113,7 +112,7 @@ * data << QPoint(x, y); * data << ...; * ... - * urlNavigator::saveLocationState(state); + * urlNavigator->saveLocationState(state); * \endcode * * @since 4.5 @@ -164,6 +163,8 @@ * * @see KUrlNavigator::setHomeUrl() */ + // KDE5: Remove the home-property. It is sufficient to invoke + // KUrlNavigator::setLocationUrl(homeUrl) on application-side. void goHome(); /** @@ -171,6 +172,8 @@ * home URL is set, the default home path of the user is used. * @since 4.5 */ + // KDE5: Remove the home-property. It is sufficient to invoke + // KUrlNavigator::setLocationUrl(homeUrl) on application-side. void setHomeUrl(const KUrl& url); KUrl homeUrl() const; @@ -265,6 +268,8 @@ * If an application supports only some special protocols, they can be set * with \a protocols . */ + // KDE5: Think about removing the custom-protocols-property. It had been used + // only by one application currently which uses a different approach now. void setCustomProtocols(const QStringList& protocols); /** @@ -272,13 +277,12 @@ */ QStringList customProtocols() const; +#if !defined(KDE_NO_DEPRECATED) && !defined(DOXYGEN_SHOULD_SKIP_THIS) /** * @return The current URL of the location. * @deprecated Use KUrlNavigator::locationUrl() instead. */ -#ifndef KDE_NO_DEPRECATED KDE_DEPRECATED const KUrl& url() const; -#endif /** * @return The portion of the current URL up to the path part given @@ -290,9 +294,7 @@ * - index >= 3: /home/peter/Documents/Music * @deprecated It should not be necessary for a client of KUrlNavigator to query this information. */ -#ifndef KDE_NO_DEPRECATED KDE_DEPRECATED KUrl url(int index) const; -#endif /** * @return URL for the history element with the index \a historyIndex. @@ -300,29 +302,22 @@ * @since 4.3 * @deprecated Use KUrlNavigator::locationUrl(historyIndex) instead. */ -#ifndef KDE_NO_DEPRECATED KDE_DEPRECATED KUrl historyUrl(int historyIndex) const; -#endif /** * @return The saved root URL for the current URL (see KUrlNavigator::saveRootUrl()). * @deprecated Use KUrlNavigator::locationState() instead. */ -#ifndef KDE_NO_DEPRECATED KDE_DEPRECATED const KUrl& savedRootUrl() const; -#endif /** * @return The saved contents position of the upper left corner * for the current URL. * @deprecated Use KUrlNavigator::locationState() instead. */ -#ifndef KDE_NO_DEPRECATED KDE_DEPRECATED QPoint savedPosition() const; -#endif /** @deprecated Use setHomeUrl(const KUrl& url) instead. */ -#ifndef KDE_NO_DEPRECATED KDE_DEPRECATED void setHomeUrl(const QString& homeUrl); #endif @@ -343,30 +338,28 @@ */ void requestActivation(); - /* @see QWidget::setFocus() */ +#if !defined(DOXYGEN_SHOULD_SKIP_THIS) + // KDE5: Remove and listen for focus-signal instead void setFocus(); +#endif +#if !defined(KDE_NO_DEPRECATED) && !defined(DOXYGEN_SHOULD_SKIP_THIS) /** * Sets the location to \a url. * @deprecated Use KUrlNavigator::setLocationUrl(url). */ -#ifndef KDE_NO_DEPRECATED KDE_DEPRECATED void setUrl(const KUrl& url); -#endif /** * Saves the used root URL of the content for the current history element. * @deprecated Use KUrlNavigator::saveLocationState() instead. */ -#ifndef KDE_NO_DEPRECATED KDE_DEPRECATED void saveRootUrl(const KUrl& url); -#endif /** * Saves the coordinates of the contents for the current history element. * @deprecated Use KUrlNavigator::saveLocationState() instead. */ -#ifndef KDE_NO_DEPRECATED KDE_DEPRECATED void savePosition(int x, int y); #endif @@ -426,6 +419,7 @@ */ void tabRequested(const KUrl& url); +#if !defined(KDE_NO_DEPRECATED) && !defined(DOXYGEN_SHOULD_SKIP_THIS) /** * Is emitted if the URLs \a urls have been dropped * to the destination \a destination. @@ -435,13 +429,13 @@ */ // KDE5: remove, as the signal has been replaced by // urlsDropped(const KUrl& destination, QDropEvent* event) -#ifndef KDE_NO_DEPRECATED KDE_DEPRECATED void urlsDropped(const KUrl::List& urls, const KUrl& destination); #endif protected: - /* +#if !defined(DOXYGEN_SHOULD_SKIP_THIS) + /** * If the Escape key is pressed, the navigation bar should switch * to the breadcrumb view. * @see QWidget::keyPressEvent() @@ -449,21 +443,21 @@ virtual void keyPressEvent(QKeyEvent* event); /** - * Reimplemented for internal purposes + * Reimplemented for internal purposes. */ virtual void keyReleaseEvent(QKeyEvent* event); - /* + /** * Paste the clipboard content as URL, if the middle mouse * button has been clicked. * @see QWidget::mouseReleaseEvent() */ virtual void mouseReleaseEvent(QMouseEvent* event); - /* @see QWidget::resizeEvent() */ virtual void resizeEvent(QResizeEvent* event); virtual bool eventFilter(QObject* watched, QEvent* event); +#endif private: Q_PRIVATE_SLOT(d, void slotReturnPressed()) --- trunk/KDE/kdelibs/kfile/kurlnavigatorbutton.cpp #1213577:1213578 @@ -35,6 +35,9 @@ #include #include +namespace KDEPrivate +{ + QPointer KUrlNavigatorButton::m_subDirsMenu; KUrlNavigatorButton::KUrlNavigatorButton(const KUrl& url, QWidget* parent) : @@ -599,5 +602,6 @@ } } +} // namespace KDEPrivate #include "kurlnavigatorbutton_p.moc" --- trunk/KDE/kdelibs/kfile/kurlnavigatorbutton_p.h #1213577:1213578 @@ -39,6 +39,9 @@ class Job; } +namespace KDEPrivate +{ + /** * @brief Button of the URL navigator which contains one part of an URL. * @@ -185,4 +188,6 @@ static QPointer m_subDirsMenu; }; +} // namespace KDEPrivate + #endif --- trunk/KDE/kdelibs/kfile/kurlnavigatorbuttonbase.cpp #1213577:1213578 @@ -32,6 +32,9 @@ #include #include +namespace KDEPrivate +{ + KUrlNavigatorButtonBase::KUrlNavigatorButtonBase(QWidget* parent) : QPushButton(parent), m_active(true), @@ -134,4 +137,6 @@ setActive(true); } +} // namespace KDEPrivate + #include "kurlnavigatorbuttonbase_p.moc" --- trunk/KDE/kdelibs/kfile/kurlnavigatorbuttonbase_p.h #1213577:1213578 @@ -27,6 +27,9 @@ class KUrl; class QEvent; +namespace KDEPrivate +{ + /** * @brief Base class for buttons of the URL navigator. * @@ -80,4 +83,6 @@ int m_displayHint; }; +} // namespace KDEPrivate + #endif --- trunk/KDE/kdelibs/kfile/kurlnavigatordropdownbutton.cpp #1213577:1213578 @@ -26,6 +26,9 @@ #include #include +namespace KDEPrivate +{ + KUrlNavigatorDropDownButton::KUrlNavigatorDropDownButton(QWidget* parent) : KUrlNavigatorButtonBase(parent) { @@ -64,7 +67,8 @@ } else { style()->drawPrimitive(QStyle::PE_IndicatorArrowLeft, &option, &painter, this); } - } +} // namespace KDEPrivate + #include "kurlnavigatordropdownbutton_p.moc" --- trunk/KDE/kdelibs/kfile/kurlnavigatordropdownbutton_p.h #1213577:1213578 @@ -22,6 +22,9 @@ #include "kurlnavigatorbuttonbase_p.h" +namespace KDEPrivate +{ + /** * @brief Button of the URL navigator which offers a drop down menu * of hidden paths. @@ -44,4 +47,6 @@ virtual void paintEvent(QPaintEvent* event); }; +} // namespace KDEPrivate + #endif --- trunk/KDE/kdelibs/kfile/kurlnavigatormenu.cpp #1213577:1213578 @@ -23,6 +23,9 @@ #include +namespace KDEPrivate +{ + KUrlNavigatorMenu::KUrlNavigatorMenu(QWidget* parent) : KMenu(parent) { @@ -66,4 +69,6 @@ KMenu::mouseReleaseEvent(event); } +} // namespace KDEPrivate + #include "kurlnavigatormenu_p.moc" --- trunk/KDE/kdelibs/kfile/kurlnavigatormenu_p.h #1213577:1213578 @@ -23,10 +23,15 @@ #include +namespace KDEPrivate +{ + /** * @brief Provides drop-down menus for the URL navigator. * * The implementation extends KMenu with drag & drop support. + * + * @internal */ class KUrlNavigatorMenu : public KMenu { @@ -56,4 +61,6 @@ virtual void mouseReleaseEvent(QMouseEvent* event); }; +} // namespace KDEPrivate + #endif --- trunk/KDE/kdelibs/kfile/kurlnavigatorplacesselector.cpp #1213577:1213578 @@ -34,6 +34,9 @@ #include #include +namespace KDEPrivate +{ + KUrlNavigatorPlacesSelector::KUrlNavigatorPlacesSelector(QWidget* parent, KFilePlacesModel* placesModel) : KUrlNavigatorButtonBase(parent), m_selectedItem(-1), @@ -117,8 +120,7 @@ m_selectedItem = index.row(); m_selectedUrl = url; setIcon(m_placesModel->icon(index)); - } - else { + } else { m_selectedItem = -1; // No bookmark has been found which matches to the given Url. Show // a generic folder icon as pixmap for indication: @@ -213,8 +215,7 @@ m_lastClickedIndex = index; m_placesModel->requestSetup(index); return; - } - else if (index.isValid()) { + } else if (index.isValid()) { m_selectedItem = index.row(); setIcon(m_placesModel->icon(index)); updateTeardownAction(); @@ -235,5 +236,7 @@ } } +} // namespace KDEPrivate + #include "kurlnavigatorplacesselector_p.moc" --- trunk/KDE/kdelibs/kfile/kurlnavigatorplacesselector_p.h #1213577:1213578 @@ -29,6 +29,9 @@ class KFilePlacesModel; class KMenu; +namespace KDEPrivate +{ + /** * @brief Allows to select a bookmark from a popup menu. * @@ -36,6 +39,7 @@ * inside the bookmark selector. * * @see KUrlNavigator + * @internal */ class KUrlNavigatorPlacesSelector : public KUrlNavigatorButtonBase { @@ -105,4 +109,6 @@ KUrl m_selectedUrl; }; +} // namespace KDEPrivate + #endif --- trunk/KDE/kdelibs/kfile/kurlnavigatorprotocolcombo.cpp #1213577:1213578 @@ -31,10 +31,14 @@ #include #include -namespace { +namespace +{ const int ArrowSize = 10; } +namespace KDEPrivate +{ + KUrlNavigatorProtocolCombo::KUrlNavigatorProtocolCombo(const QString& protocol, QWidget* parent) : KUrlNavigatorButtonBase(parent), m_menu(0), @@ -219,4 +223,6 @@ } } +} // namespace KDEPrivate + #include "kurlnavigatorprotocolcombo_p.moc" --- trunk/KDE/kdelibs/kfile/kurlnavigatorprotocolcombo_p.h #1213577:1213578 @@ -27,6 +27,9 @@ class QMenu; +namespace KDEPrivate +{ + /** * @brief A combobox listing available protocols. * @@ -80,4 +83,6 @@ QHash m_categories; }; +} // namespace KDEPrivate + #endif --- trunk/KDE/kdelibs/kfile/kurlnavigatortogglebutton.cpp #1213577:1213578 @@ -27,6 +27,9 @@ #include #include +namespace KDEPrivate +{ + KUrlNavigatorToggleButton::KUrlNavigatorToggleButton(QWidget* parent) : KUrlNavigatorButtonBase(parent) { @@ -98,4 +101,6 @@ setCursor(isChecked() ? Qt::ArrowCursor : Qt::IBeamCursor); } +} // namespace KDEPrivate + #include "kurlnavigatortogglebutton_p.moc" --- trunk/KDE/kdelibs/kfile/kurlnavigatortogglebutton_p.h #1213577:1213578 @@ -23,6 +23,9 @@ #include "kurlnavigatorbuttonbase_p.h" #include +namespace KDEPrivate +{ + /** * @brief Represents the button of the URL navigator to switch to * the editable mode. @@ -53,4 +56,6 @@ QPixmap m_pixmap; }; +} // namespace KDEPrivate + #endif