]>
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 <QtGui/QPushButton>
26 #include <QtGui/QPixmap>
27 #include <QtCore/QEvent>
28 #include <QtGui/QLabel>
29 #include <QtCore/QList>
32 #include <kmimetype.h>
33 #include <kdesktopfileactions.h>
52 * @brief Sidebar for showing meta information of one ore more selected items.
54 class InfoSidebarPage
: public SidebarPage
59 explicit InfoSidebarPage(QWidget
* parent
= 0);
60 virtual ~InfoSidebarPage();
63 /** @see SidebarPage::setUrl() */
64 virtual void setUrl(const KUrl
& url
);
66 /** @see SidebarPage::setSelection() */
67 virtual void setSelection(const KFileItemList
& selection
);
70 * Does a delayed request of information for the item of the given URL.
71 * If within this delay InfoSidebarPage::setUrl() or InfoSidebarPage::setSelection()
72 * are invoked, then the request will be skipped. Requesting a delayed item information
73 * makes sense when hovering items.
75 void requestDelayedItemInfo(const KUrl
& url
);
78 /** @see QWidget::showEvent() */
79 virtual void showEvent(QShowEvent
* event
);
81 /** @see QWidget::resizeEvent() */
82 virtual void resizeEvent(QResizeEvent
* event
);
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 showIcon(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 showPreview(const KFileItem
& item
, const QPixmap
& pixmap
);
111 * Checks whether the an URL is repesented by a bookmark. If yes,
112 * then the bookmark icon and name are shown instead of a preview.
113 * @return True, if the URL represents exactly a bookmark.
114 * @param url The url to check.
116 bool applyBookmark(const KUrl
& url
);
118 /** Assures that any pending item information request is cancelled. */
119 void cancelRequest();
121 // TODO: the following methods are just a prototypes for meta
122 // info generation...
123 void createMetaInfo();
124 void addInfoLine(const QString
& labelText
,
125 const QString
& infoText
);
126 void beginInfoLines();
130 * Returns true, if the string \a key represents a meta information
131 * that should be shown.
133 bool showMetaInfo(const QString
& key
) const;
136 bool m_multipleSelection
;
137 bool m_pendingPreview
;
142 PixmapViewer
* m_preview
;
148 MetaDataWidget
* m_metadataWidget
;
151 #endif // INFOSIDEBARPAGE_H