]>
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 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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>
54 * @brief Prototype for a information sidebar.
56 * Will be exchanged in future releases by pluggable sidebar pages...
58 class InfoSidebarPage
: public SidebarPage
63 explicit InfoSidebarPage(DolphinMainWindow
* mainWindow
, QWidget
* parent
= 0);
64 virtual ~InfoSidebarPage();
67 /** @see SidebarPage::activeViewChanged() */
68 virtual void activeViewChanged();
72 * Does a delayed request of information for the item of the given Url and
73 * provides default actions.
75 * @see InfoSidebarPage::showItemInfo()
77 void requestDelayedItemInfo(const KUrl
& url
);
80 * Does a request of information for the item of the given Url and
81 * provides default actions.
83 * @see InfoSidebarPage::showItemInfo()
85 void requestItemInfo(const KUrl
& url
);
88 * Shows the information for the item of the Url which has been provided by
89 * InfoSidebarPage::requestItemInfo() and provides default actions.
94 * Triggered if the request for item information has timed out.
95 * @see InfoSidebarPage::requestDelayedItemInfo()
100 * Is invoked if no preview is available for the item. In this
101 * case the icon will be shown.
103 void slotPreviewFailed(const KFileItem
* item
);
106 * Is invoked if a preview is available for the item. The preview
107 * \a pixmap is shown inside the info page.
109 void gotPreview(const KFileItem
* item
, const QPixmap
& pixmap
);
112 * Starts the service of m_actionsVector with the index \index on
113 * the shown Url (or the selected items if available).
115 void startService(int index
);
118 * Opens a dialog to change the annotation of the currently selected
121 void changeAnnotation();
125 * Connects to signals from the currently active Dolphin view to get
126 * informed about highlighting changes.
128 void connectToActiveView();
131 * Checks whether the an Url is repesented by a bookmark. If yes,
132 * then the bookmark icon and name are shown instead of a preview.
133 * @return True, if the Url represents exactly a bookmark.
134 * @param url The url to check.
136 bool applyBookmark(const KUrl
& url
);
138 /** Assures that any pending item information request is cancelled. */
139 void cancelRequest();
141 // TODO: the following methods are just a prototypes for meta
142 // info generation...
143 void createMetaInfo();
144 void addInfoLine(const QString
& labelText
,
145 const QString
& infoText
);
146 void beginInfoLines();
150 * Returns true, if the string \a key represents a meta information
151 * that should be shown.
153 bool showMetaInfo(const QString
& key
) const;
156 * Inserts the available actions to the info page for the given item.
158 void insertActions();
161 * Show the annotation of a file in the sidebar.
163 void showAnnotation(const KUrl
& file
);
166 * Show the annotations of multiple files in the sidebar.
168 void showAnnotations(const KUrl::List
& files
);
170 bool m_multipleSelection
;
171 bool m_pendingPreview
;
176 PixmapViewer
* m_preview
;
183 Q3PtrList
<QWidget
> m_actionWidgets
; // TODO: use children() from QObject instead
184 Q3ValueVector
<KDEDesktopMimeType::Service
> m_actionsVector
;
186 QLabel
* m_annotationLabel
;
187 QPushButton
* m_annotationButton
;//Move to sthing sexy visually
188 MetadataLoader
* m_metadata
;
191 // TODO #1: move to SidebarPage?
192 // TODO #2: quite same button from the optical point of view as UrlNavigatorButton
193 // -> provide helper class or common base class
194 class ServiceButton
: public QPushButton
199 ServiceButton(const QIcon
& icon
,
203 virtual ~ServiceButton();
206 void requestServiceStart(int index
);
209 virtual void paintEvent(QPaintEvent
* event
);
210 virtual void enterEvent(QEvent
* event
);
211 virtual void leaveEvent(QEvent
* event
);
221 #endif // INFOSIDEBARPAGE_H