]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/infosidebarpage.h
adapt Dolphin to kdelibs coding style (http://techbase.kde.org/Policies/Kdelibs_Codin...
[dolphin.git] / src / infosidebarpage.h
index 4b2152764a0b063047fd0d4a108ac5024308fa5c..62d0ac1cb54a507eb20500d10ecf6826d73f7291 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- *   Copyright (C) 2006 by Peter Penz <peter.penz@gmx.at>
+ *   Copyright (C) 2006 by Peter Penz <peter.penz@gmx.at>                  *
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
  *   it under the terms of the GNU General Public License as published by  *
  *   You should have received a copy of the GNU General Public License     *
  *   along with this program; if not, write to the                         *
  *   Free Software Foundation, Inc.,                                       *
- *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
+ *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA            *
  ***************************************************************************/
 
-#ifndef _INFOSIDEBARPAGE_H_
-#define _INFOSIDEBARPAGE_H_
+#ifndef INFOSIDEBARPAGE_H
+#define INFOSIDEBARPAGE_H
 
 #include <sidebarpage.h>
 
-#include <q3valuevector.h>
 #include <qpushbutton.h>
-//Added by qt3to4:
 #include <QPixmap>
 #include <QEvent>
 #include <QLabel>
-#include <Q3PtrList>
+#include <QList>
 
 #include <kurl.h>
-#include <ksortablevaluelist.h>
 #include <kmimetype.h>
+#include <kdesktopfileactions.h>
+#include <kvbox.h>
 
-namespace KIO {
-    class Job;
-};
+namespace KIO
+{
+class Job;
+}
 
 class QPixmap;
 class QIcon;
@@ -44,9 +44,9 @@ class QString;
 class QPainter;
 class KFileItem;
 class QLabel;
-class Q3VBox;
-class Q3Grid;
+class KVBox;
 class PixmapViewer;
+class MetaDataWidget;
 
 /**
  * @brief Prototype for a information sidebar.
@@ -55,35 +55,27 @@ class PixmapViewer;
  */
 class InfoSidebarPage : public SidebarPage
 {
-       Q_OBJECT
+    Q_OBJECT
 
 public:
-    InfoSidebarPage(QWidget* parent);
+    explicit InfoSidebarPage(QWidget* parent = 0);
     virtual ~InfoSidebarPage();
 
-protected:
-    /** @see SidebarPage::activeViewChanged() */
-    virtual void activeViewChanged();
+public slots:
+    void setUrl(const KUrl& url);
+    void setSelection(const KFileItemList& selection);
 
 private slots:
     /**
-     * Does a delayed request of information for the item of the given URL and
-     * provides default actions.
-     *
-     * @see InfoSidebarPage::showItemInfo()
-     */
-    void requestDelayedItemInfo(const KURL& url);
-
-    /**
-     * Does a request of information for the item of the given URL and
+     * Does a delayed request of information for the item of the given Url and
      * provides default actions.
      *
      * @see InfoSidebarPage::showItemInfo()
      */
-    void requestItemInfo(const KURL& url);
+    void requestDelayedItemInfo(const KUrl& url);
 
     /**
-     * Shows the information for the item of the URL which has been provided by
+     * Shows the information for the item of the Url which has been provided by
      * InfoSidebarPage::requestItemInfo() and provides default actions.
      */
     void showItemInfo();
@@ -108,23 +100,18 @@ private slots:
 
     /**
      * Starts the service of m_actionsVector with the index \index on
-     * the shown URL (or the selected items if available).
+     * the shown Url (or the selected items if available).
      */
     void startService(int index);
 
 private:
     /**
-     * Connects to signals from the currently active Dolphin view to get
-     * informed about highlighting changes.
-     */
-    void connectToActiveView();
-
-    /**
-     * Checks whether the current URL is repesented by a bookmark. If yes,
+     * 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.
+     * @return True, if the Url represents exactly a bookmark.
+     * @param url The url to check.
      */
-    bool applyBookmark();
+    bool applyBookmark(const KUrl& url);
 
     /** Assures that any pending item information request is cancelled. */
     void cancelRequest();
@@ -151,23 +138,24 @@ private:
     bool m_multipleSelection;
     bool m_pendingPreview;
     QTimer* m_timer;
-    KURL m_shownURL;
-    KURL m_urlCandidate;
+    KUrl m_shownUrl;
+    KUrl m_urlCandidate;
+    KFileItemList m_currentSelection;
 
     PixmapViewer* m_preview;
     QLabel* m_name;
 
-    int m_currInfoLineIdx;
-    Q3Grid* m_infoGrid;
-    Q3PtrList<QLabel> m_infoWidgets;       // TODO: use children() from QObject instead
+    QString m_infoLines;
+    QLabel* m_infos;
+
+    KVBox* m_actionBox;
+    QVector<KDesktopFileActions::Service> m_actionsVector;
 
-    Q3VBox* m_actionBox;
-    Q3PtrList<QWidget> m_actionWidgets;    // TODO: use children() from QObject instead
-    Q3ValueVector<KDEDesktopMimeType::Service> m_actionsVector;
+    MetaDataWidget* m_metadataWidget;
 };
 
 // TODO #1: move to SidebarPage?
-// TODO #2: quite same button from the optical point of view as URLNavigatorButton
+// TODO #2: quite same button from the optical point of view as UrlNavigatorButton
 // -> provide helper class or common base class
 class ServiceButton : public QPushButton
 {
@@ -184,7 +172,7 @@ signals:
     void requestServiceStart(int index);
 
 protected:
-    virtual void drawButton(QPainter* painter);
+    virtual void paintEvent(QPaintEvent* event);
     virtual void enterEvent(QEvent* event);
     virtual void leaveEvent(QEvent* event);
 
@@ -196,4 +184,4 @@ private:
     int m_index;
 };
 
-#endif // _INFOSIDEBARPAGE_H_
+#endif // INFOSIDEBARPAGE_H