2006-11-21 06:02:05 +00:00
|
|
|
/***************************************************************************
|
2007-03-11 14:41:09 +00:00
|
|
|
* Copyright (C) 2006 by Peter Penz <peter.penz@gmx.at> *
|
2006-11-21 06:02:05 +00:00
|
|
|
* *
|
|
|
|
* 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 *
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or *
|
|
|
|
* (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
* This program is distributed in the hope that it will be useful, *
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
* GNU General Public License for more details. *
|
|
|
|
* *
|
|
|
|
* 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., *
|
2006-12-08 21:24:08 +00:00
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
|
2006-11-21 06:02:05 +00:00
|
|
|
***************************************************************************/
|
|
|
|
|
2007-03-02 18:59:09 +00:00
|
|
|
#ifndef INFOSIDEBARPAGE_H
|
|
|
|
#define INFOSIDEBARPAGE_H
|
2006-11-21 06:02:05 +00:00
|
|
|
|
|
|
|
#include <sidebarpage.h>
|
|
|
|
|
2007-04-12 13:02:58 +00:00
|
|
|
#include <QtGui/QPushButton>
|
2006-11-21 06:02:05 +00:00
|
|
|
#include <QPixmap>
|
|
|
|
#include <QEvent>
|
|
|
|
#include <QLabel>
|
2007-03-22 14:08:38 +00:00
|
|
|
#include <QList>
|
2006-11-21 06:02:05 +00:00
|
|
|
|
|
|
|
#include <kurl.h>
|
|
|
|
#include <kmimetype.h>
|
2007-03-26 08:24:06 +00:00
|
|
|
#include <kdesktopfileactions.h>
|
2006-11-23 07:54:24 +00:00
|
|
|
#include <kvbox.h>
|
2006-11-21 06:02:05 +00:00
|
|
|
|
2007-04-09 19:12:54 +00:00
|
|
|
namespace KIO
|
|
|
|
{
|
2007-05-03 05:09:18 +00:00
|
|
|
class Job;
|
2006-12-29 14:28:16 +00:00
|
|
|
}
|
2006-11-21 06:02:05 +00:00
|
|
|
|
|
|
|
class QPixmap;
|
|
|
|
class QIcon;
|
|
|
|
class QString;
|
|
|
|
class QPainter;
|
|
|
|
class KFileItem;
|
|
|
|
class QLabel;
|
2006-11-23 07:54:24 +00:00
|
|
|
class KVBox;
|
2006-11-21 06:02:05 +00:00
|
|
|
class PixmapViewer;
|
2007-03-20 09:01:22 +00:00
|
|
|
class MetaDataWidget;
|
2006-11-21 06:02:05 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Prototype for a information sidebar.
|
|
|
|
*
|
|
|
|
* Will be exchanged in future releases by pluggable sidebar pages...
|
|
|
|
*/
|
|
|
|
class InfoSidebarPage : public SidebarPage
|
|
|
|
{
|
2007-04-09 19:12:54 +00:00
|
|
|
Q_OBJECT
|
2006-11-21 06:02:05 +00:00
|
|
|
|
|
|
|
public:
|
2007-03-25 06:44:28 +00:00
|
|
|
explicit InfoSidebarPage(QWidget* parent = 0);
|
2006-11-21 06:02:05 +00:00
|
|
|
virtual ~InfoSidebarPage();
|
|
|
|
|
2007-03-25 06:44:28 +00:00
|
|
|
public slots:
|
|
|
|
void setUrl(const KUrl& url);
|
|
|
|
void setSelection(const KFileItemList& selection);
|
2006-11-21 06:02:05 +00:00
|
|
|
|
|
|
|
private slots:
|
|
|
|
/**
|
2006-11-22 17:13:11 +00:00
|
|
|
* Does a delayed request of information for the item of the given Url and
|
2006-11-21 06:02:05 +00:00
|
|
|
* provides default actions.
|
|
|
|
*
|
|
|
|
* @see InfoSidebarPage::showItemInfo()
|
|
|
|
*/
|
2006-11-22 08:22:45 +00:00
|
|
|
void requestDelayedItemInfo(const KUrl& url);
|
2006-11-21 06:02:05 +00:00
|
|
|
|
|
|
|
/**
|
2006-11-22 17:13:11 +00:00
|
|
|
* Shows the information for the item of the Url which has been provided by
|
2006-11-21 06:02:05 +00:00
|
|
|
* InfoSidebarPage::requestItemInfo() and provides default actions.
|
|
|
|
*/
|
|
|
|
void showItemInfo();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Triggered if the request for item information has timed out.
|
|
|
|
* @see InfoSidebarPage::requestDelayedItemInfo()
|
|
|
|
*/
|
|
|
|
void slotTimeout();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Is invoked if no preview is available for the item. In this
|
|
|
|
* case the icon will be shown.
|
|
|
|
*/
|
2007-05-03 05:52:54 +00:00
|
|
|
void showIcon(const KFileItem& item);
|
2006-11-21 06:02:05 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Is invoked if a preview is available for the item. The preview
|
|
|
|
* \a pixmap is shown inside the info page.
|
|
|
|
*/
|
2007-05-03 05:52:54 +00:00
|
|
|
void showPreview(const KFileItem& item, const QPixmap& pixmap);
|
2006-11-21 06:02:05 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
/**
|
2007-02-23 02:28:27 +00:00
|
|
|
* Checks whether the an Url is repesented by a bookmark. If yes,
|
2006-11-21 06:02:05 +00:00
|
|
|
* then the bookmark icon and name are shown instead of a preview.
|
2006-11-22 17:13:11 +00:00
|
|
|
* @return True, if the Url represents exactly a bookmark.
|
2007-02-23 02:28:27 +00:00
|
|
|
* @param url The url to check.
|
2006-11-21 06:02:05 +00:00
|
|
|
*/
|
2007-02-23 02:28:27 +00:00
|
|
|
bool applyBookmark(const KUrl& url);
|
2006-11-21 06:02:05 +00:00
|
|
|
|
|
|
|
/** Assures that any pending item information request is cancelled. */
|
|
|
|
void cancelRequest();
|
|
|
|
|
|
|
|
// TODO: the following methods are just a prototypes for meta
|
|
|
|
// info generation...
|
|
|
|
void createMetaInfo();
|
|
|
|
void addInfoLine(const QString& labelText,
|
|
|
|
const QString& infoText);
|
|
|
|
void beginInfoLines();
|
|
|
|
void endInfoLines();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true, if the string \a key represents a meta information
|
|
|
|
* that should be shown.
|
|
|
|
*/
|
|
|
|
bool showMetaInfo(const QString& key) const;
|
|
|
|
|
2007-05-03 05:52:54 +00:00
|
|
|
private:
|
2006-11-21 06:02:05 +00:00
|
|
|
bool m_multipleSelection;
|
|
|
|
bool m_pendingPreview;
|
|
|
|
QTimer* m_timer;
|
2006-11-22 17:13:11 +00:00
|
|
|
KUrl m_shownUrl;
|
2006-11-22 08:22:45 +00:00
|
|
|
KUrl m_urlCandidate;
|
2007-04-09 19:12:54 +00:00
|
|
|
KFileItemList m_currentSelection;
|
2006-11-21 06:02:05 +00:00
|
|
|
|
|
|
|
PixmapViewer* m_preview;
|
|
|
|
QLabel* m_name;
|
|
|
|
|
2007-02-22 16:45:53 +00:00
|
|
|
QString m_infoLines;
|
|
|
|
QLabel* m_infos;
|
2006-11-21 06:02:05 +00:00
|
|
|
|
2007-03-20 09:01:22 +00:00
|
|
|
MetaDataWidget* m_metadataWidget;
|
2006-11-21 06:02:05 +00:00
|
|
|
};
|
|
|
|
|
2007-03-02 18:59:09 +00:00
|
|
|
#endif // INFOSIDEBARPAGE_H
|