X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/2ed4d8dcc483ac6067149647eb457d46be7111c5..d6488887ecf69d7f192b94de8dce34fae0b7eb76:/src/infosidebarpage.h diff --git a/src/infosidebarpage.h b/src/infosidebarpage.h index 9fcf449be..ef014b316 100644 --- a/src/infosidebarpage.h +++ b/src/infosidebarpage.h @@ -33,18 +33,10 @@ #include #include -namespace KIO -{ - class Job; -} - class QPixmap; -class QIcon; class QString; -class QPainter; class KFileItem; class QLabel; -class KVBox; class PixmapViewer; class MetaDataWidget; @@ -59,6 +51,9 @@ public: explicit InfoSidebarPage(QWidget* parent = 0); virtual ~InfoSidebarPage(); + /** @see QWidget::sizeHint() */ + virtual QSize sizeHint() const; + public slots: /** @see SidebarPage::setUrl() */ virtual void setUrl(const KUrl& url); @@ -67,12 +62,12 @@ public slots: virtual void setSelection(const KFileItemList& selection); /** - * Does a delayed request of information for the item of the given URL. + * Does a delayed request of information for the item \a item. * If within this delay InfoSidebarPage::setUrl() or InfoSidebarPage::setSelection() * are invoked, then the request will be skipped. Requesting a delayed item information * makes sense when hovering items. */ - void requestDelayedItemInfo(const KUrl& url); + void requestDelayedItemInfo(const KFileItem& item); protected: /** @see QWidget::showEvent() */ @@ -107,43 +102,50 @@ private slots: void showPreview(const KFileItem& item, const QPixmap& pixmap); private: + enum { TimerDelay = 300 }; + /** - * Checks whether the an URL is repesented by a bookmark. If yes, - * then the bookmark icon and name are shown instead of a preview. - * @return True, if the URL represents exactly a bookmark. + * Checks whether the an URL is repesented by a place. If yes, + * then the place icon and name are shown instead of a preview. + * @return True, if the URL represents exactly a place. * @param url The url to check. */ - bool applyBookmark(const KUrl& url); + bool applyPlace(const KUrl& url); /** Assures that any pending item information request is cancelled. */ void cancelRequest(); - // TODO: the following methods are just a prototypes for meta - // info generation... - void createMetaInfo(); - void addInfoLine(const QString& labelText, + /** + * Shows the meta information for the current shown item inside + * a label. + */ + void showMetaInfo(); + + /** + * Adds the texts \a labelText and \a infoText as one formated line + * to text. + */ + void addInfoLine(QString& text, + const QString& labelText, const QString& infoText); - void beginInfoLines(); - void endInfoLines(); /** + * Converts the meta key \a key to a readable format into \a text. * Returns true, if the string \a key represents a meta information - * that should be shown. + * that should be shown. If false is returned, \a text is not modified. */ - bool showMetaInfo(const QString& key) const; + bool convertMetaInfo(const QString& key, QString& text) const; private: - bool m_multipleSelection; bool m_pendingPreview; QTimer* m_timer; KUrl m_shownUrl; KUrl m_urlCandidate; PixmapViewer* m_preview; - QLabel* m_name; + QLabel* m_nameLabel; - QString m_infoLines; - QLabel* m_infos; + QLabel* m_infoLabel; MetaDataWidget* m_metadataWidget; };