]>
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 <ksortablevaluelist.h>
35 #include <kmimetype.h>
52 * @brief Prototype for a information sidebar.
54 * Will be exchanged in future releases by pluggable sidebar pages...
56 class InfoSidebarPage
: public SidebarPage
61 InfoSidebarPage(QWidget
* parent
);
62 virtual ~InfoSidebarPage();
65 /** @see SidebarPage::activeViewChanged() */
66 virtual void activeViewChanged();
70 * Does a delayed request of information for the item of the given URL and
71 * provides default actions.
73 * @see InfoSidebarPage::showItemInfo()
75 void requestDelayedItemInfo(const KURL
& url
);
78 * Does a request of information for the item of the given URL and
79 * provides default actions.
81 * @see InfoSidebarPage::showItemInfo()
83 void requestItemInfo(const KURL
& url
);
86 * Shows the information for the item of the URL which has been provided by
87 * InfoSidebarPage::requestItemInfo() and provides default actions.
92 * Triggered if the request for item information has timed out.
93 * @see InfoSidebarPage::requestDelayedItemInfo()
98 * Is invoked if no preview is available for the item. In this
99 * case the icon will be shown.
101 void slotPreviewFailed(const KFileItem
* item
);
104 * Is invoked if a preview is available for the item. The preview
105 * \a pixmap is shown inside the info page.
107 void gotPreview(const KFileItem
* item
, const QPixmap
& pixmap
);
110 * Starts the service of m_actionsVector with the index \index on
111 * the shown URL (or the selected items if available).
113 void startService(int index
);
117 * Connects to signals from the currently active Dolphin view to get
118 * informed about highlighting changes.
120 void connectToActiveView();
123 * Checks whether the current URL is repesented by a bookmark. If yes,
124 * then the bookmark icon and name are shown instead of a preview.
125 * @return True, if the URL represents exactly a bookmark.
127 bool applyBookmark();
129 /** Assures that any pending item information request is cancelled. */
130 void cancelRequest();
132 // TODO: the following methods are just a prototypes for meta
133 // info generation...
134 void createMetaInfo();
135 void addInfoLine(const QString
& labelText
,
136 const QString
& infoText
);
137 void beginInfoLines();
141 * Returns true, if the string \a key represents a meta information
142 * that should be shown.
144 bool showMetaInfo(const QString
& key
) const;
147 * Inserts the available actions to the info page for the given item.
149 void insertActions();
151 bool m_multipleSelection
;
152 bool m_pendingPreview
;
157 PixmapViewer
* m_preview
;
160 int m_currInfoLineIdx
;
162 Q3PtrList
<QLabel
> m_infoWidgets
; // TODO: use children() from QObject instead
165 Q3PtrList
<QWidget
> m_actionWidgets
; // TODO: use children() from QObject instead
166 Q3ValueVector
<KDEDesktopMimeType::Service
> m_actionsVector
;
169 // TODO #1: move to SidebarPage?
170 // TODO #2: quite same button from the optical point of view as URLNavigatorButton
171 // -> provide helper class or common base class
172 class ServiceButton
: public QPushButton
177 ServiceButton(const QIcon
& icon
,
181 virtual ~ServiceButton();
184 void requestServiceStart(int index
);
187 virtual void drawButton(QPainter
* painter
);
188 virtual void enterEvent(QEvent
* event
);
189 virtual void leaveEvent(QEvent
* event
);
199 #endif // _INFOSIDEBARPAGE_H_