1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
|
/***************************************************************************
* Copyright (C) 2006 by Peter Penz <peter.penz@gmx.at>
* *
* 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., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
#ifndef _INFOSIDEBARPAGE_H_
#define _INFOSIDEBARPAGE_H_
#include <sidebarpage.h>
#include <tqvaluevector.h>
#include <tqpushbutton.h>
#include <kurl.h>
#include <ksortablevaluelist.h>
#include <kmimetype.h>
namespace KIO {
class Job;
};
class TQPixmap;
class TQIconSet;
class TQString;
class TQPainter;
class KFileItem;
class TQLabel;
class TQVBox;
class TQGrid;
class PixmapViewer;
/**
* @brief Prototype for a information sidebar.
*
* Will be exchanged in future releases by pluggable sidebar pages...
*/
class InfoSidebarPage : public SidebarPage
{
Q_OBJECT
TQ_OBJECT
public:
InfoSidebarPage(TQWidget* parent);
virtual ~InfoSidebarPage();
protected:
/** @see SidebarPage::activeViewChanged() */
virtual void activeViewChanged();
private slots:
/**
* Does a delayed request of information for the item of the given URL and
* provides default actions.
*
* @see InfoSidebarPage::showItemInfo()
*/
void requestDelayedItemInfo(const KURL& url);
/**
* Does a request of information for the item of the given URL and
* provides default actions.
*
* @see InfoSidebarPage::showItemInfo()
*/
void requestItemInfo(const KURL& url);
/**
* Shows the information for the item of the URL which has been provided by
* 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.
*/
void slotPreviewFailed(const KFileItem* item);
/**
* Is invoked if a preview is available for the item. The preview
* \a pixmap is shown inside the info page.
*/
void gotPreview(const KFileItem* item, const TQPixmap& pixmap);
/**
* Starts the service of m_actionsVector with the index \index on
* the shown URL (or the selected items if available).
*/
void startService(int index);
private:
/**
* Connects to signals from the currently active Dolphin view to get
* informed about highlighting changes.
*/
void connectToActiveView();
/**
* Checks whether the current URL is repesented by a bookmark. If yes,
* then the bookmark icon and name are shown instead of a preview.
* @return True, if the URL represents exactly a bookmark.
*/
bool applyBookmark();
/** 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 TQString& labelText,
const TQString& infoText);
void beginInfoLines();
void endInfoLines();
/**
* Returns true, if the string \a key represents a meta information
* that should be shown.
*/
bool showMetaInfo(const TQString& key) const;
/**
* Inserts the available actions to the info page for the given item.
*/
void insertActions();
bool m_multipleSelection;
bool m_pendingPreview;
TQTimer* m_timer;
KURL m_shownURL;
KURL m_urlCandidate;
PixmapViewer* m_preview;
TQLabel* m_name;
int m_currInfoLineIdx;
TQGrid* m_infoGrid;
TQPtrList<TQLabel> m_infoWidgets; // TODO: use tqchildren() from TQObject instead
TQVBox* m_actionBox;
TQPtrList<TQWidget> m_actionWidgets; // TODO: use tqchildren() from TQObject instead
TQValueVector<KDEDesktopMimeType::Service> m_actionsVector;
};
// TODO #1: move to SidebarPage?
// TODO #2: quite same button from the optical point of view as URLNavigatorButton
// -> provide helper class or common base class
class ServiceButton : public TQPushButton
{
Q_OBJECT
TQ_OBJECT
public:
ServiceButton(const TQIconSet& icon,
const TQString& text,
TQWidget* parent,
int index);
virtual ~ServiceButton();
signals:
void requestServiceStart(int index);
protected:
virtual void drawButton(TQPainter* painter);
virtual void enterEvent(TQEvent* event);
virtual void leaveEvent(TQEvent* event);
private slots:
void slotReleased();
private:
bool m_hover;
int m_index;
};
#endif // _INFOSIDEBARPAGE_H_
|