]>
cloud.milkyroute.net Git - dolphin.git/blob - src/infosidebarpage.h
1 /***************************************************************************
2 * Copyright (C) 2006 by Peter Penz <peter.penz@gmx.at>
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
18 ***************************************************************************/
20 #ifndef _INFOSIDEBARPAGE_H_
21 #define _INFOSIDEBARPAGE_H_
23 #include <sidebarpage.h>
25 #include <q3valuevector.h>
26 #include <qpushbutton.h>
34 #include <kmimetype.h>
35 #include <kdedesktopmimetype.h>
53 * @brief Prototype for a information sidebar.
55 * Will be exchanged in future releases by pluggable sidebar pages...
57 class InfoSidebarPage
: public SidebarPage
62 InfoSidebarPage(DolphinMainWindow
* mainWindow
, QWidget
* parent
=0);
63 virtual ~InfoSidebarPage();
66 /** @see SidebarPage::activeViewChanged() */
67 virtual void activeViewChanged();
71 * Does a delayed request of information for the item of the given Url and
72 * provides default actions.
74 * @see InfoSidebarPage::showItemInfo()
76 void requestDelayedItemInfo(const KUrl
& url
);
79 * Does a request of information for the item of the given Url and
80 * provides default actions.
82 * @see InfoSidebarPage::showItemInfo()
84 void requestItemInfo(const KUrl
& url
);
87 * Shows the information for the item of the Url which has been provided by
88 * InfoSidebarPage::requestItemInfo() and provides default actions.
93 * Triggered if the request for item information has timed out.
94 * @see InfoSidebarPage::requestDelayedItemInfo()
99 * Is invoked if no preview is available for the item. In this
100 * case the icon will be shown.
102 void slotPreviewFailed(const KFileItem
* item
);
105 * Is invoked if a preview is available for the item. The preview
106 * \a pixmap is shown inside the info page.
108 void gotPreview(const KFileItem
* item
, const QPixmap
& pixmap
);
111 * Starts the service of m_actionsVector with the index \index on
112 * the shown Url (or the selected items if available).
114 void startService(int index
);
118 * Connects to signals from the currently active Dolphin view to get
119 * informed about highlighting changes.
121 void connectToActiveView();
124 * Checks whether the current Url is repesented by a bookmark. If yes,
125 * then the bookmark icon and name are shown instead of a preview.
126 * @return True, if the Url represents exactly a bookmark.
128 bool applyBookmark();
130 /** Assures that any pending item information request is cancelled. */
131 void cancelRequest();
133 // TODO: the following methods are just a prototypes for meta
134 // info generation...
135 void createMetaInfo();
136 void addInfoLine(const QString
& labelText
,
137 const QString
& infoText
);
138 void beginInfoLines();
142 * Returns true, if the string \a key represents a meta information
143 * that should be shown.
145 bool showMetaInfo(const QString
& key
) const;
148 * Inserts the available actions to the info page for the given item.
150 void insertActions();
152 bool m_multipleSelection
;
153 bool m_pendingPreview
;
158 PixmapViewer
* m_preview
;
161 int m_currInfoLineIdx
;
163 Q3PtrList
<QLabel
> m_infoWidgets
; // TODO: use children() from QObject instead
166 Q3PtrList
<QWidget
> m_actionWidgets
; // TODO: use children() from QObject instead
167 Q3ValueVector
<KDEDesktopMimeType::Service
> m_actionsVector
;
170 // TODO #1: move to SidebarPage?
171 // TODO #2: quite same button from the optical point of view as UrlNavigatorButton
172 // -> provide helper class or common base class
173 class ServiceButton
: public QPushButton
178 ServiceButton(const QIcon
& icon
,
182 virtual ~ServiceButton();
185 void requestServiceStart(int index
);
188 virtual void drawButton(QPainter
* painter
);
189 virtual void enterEvent(QEvent
* event
);
190 virtual void leaveEvent(QEvent
* event
);
200 #endif // _INFOSIDEBARPAGE_H_