1
/***************************************************************************
2
* Copyright (C) 2003 by S�bastien Lao�t *
3
* sebastien.laout@tuxfamily.org *
5
* This program is free software; you can redistribute it and/or modify *
6
* it under the terms of the GNU General Public License as published by *
7
* the Free Software Foundation; either version 2 of the License, or *
8
* (at your option) any later version. *
10
* This program is distributed in the hope that it will be useful, *
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13
* GNU General Public License for more details. *
15
* You should have received a copy of the GNU General Public License *
16
* along with this program; if not, write to the *
17
* Free Software Foundation, Inc., *
18
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19
***************************************************************************/
26
#include <kdialogbase.h>
30
#include "focusedwidgets.h"
31
#include "variouswidgets.h"
48
class ColorIconFactory : public QIconFactory
53
QPixmap* createPixmap(const QIconSet &iconSet, QIconSet::Size size, QIconSet::Mode mode, QIconSet::State state);
55
static ColorIconFactory *globalColorIconFactory;
58
class ColorIconSet : public QIconSet
61
ColorIconSet(const QColor &color);
63
// QPixmap pixmap(Size size, Mode mode, State state = Off);
65
void setColor(const QColor &color);
70
class ColorAction : public KAction
74
ColorAction(const QColor &color, const QString &text, const KShortcut &cut,
75
KActionCollection *parent, const char *name);
77
// QIconSet iconSet(KIcon::Group, int size = 0) /*const*/;
79
void colorChanged(const QColor &color);
86
/** A simple widget, that all Item content edit widget must inherit
87
* for have various methods such as saveChanges() (must be reimplemented).
88
* @author S�bastien Lao�t
90
class ItemEditWidgetBase : public QWidget
94
ItemEditWidgetBase(Item *item, QWidget *parent = 0, const char *name = 0, WFlags fl = 0);
95
~ItemEditWidgetBase();
97
virtual void saveChanges() = 0;
98
virtual void goFirstFocus() = 0;
104
bool m_isAlreadyFirstFocused;
107
/** The base class for content item editors.
108
* It connect and manage the widgets and provide pointers to them.
109
* Different editors then can be designed : a dialog that layout them
110
* or an inline editor that place toolbar in a MainWindow, and editor in another place...
111
* @author S�bastien Lao�t
113
class ItemEditorBase : public QObject
117
ItemEditorBase(Item *item);
118
Item* editedItem() { return m_item; }
119
KToolBar* toolbar() { return m_toolbar; }
120
QWidget* editorWidget() { return m_editorWidget; }
121
QWidget* extraWidget() { return m_extraWidget; }
123
virtual void saveChanges() = 0;
124
virtual void goFirstFocus() = 0;
130
QWidget *m_editorWidget;
131
QWidget *m_extraWidget;
134
/** Editor to edit Text Item content.
135
* @author S�bastien Lao�t
137
class ItemTextEditor : public ItemEditorBase
141
ItemTextEditor(Item *item, QWidget *toolbarParent, QWidget *widgetsParent, QKeyEvent *ke = 0L);
147
void changeFont(int fontType);
148
void changeColor(const QColor &color);
150
void slotEscapePressed();
152
FocusedTextEdit *m_text;
153
FocusedComboBox *m_font;
154
FocusedColorCombo *m_color;
157
/** The widget to edit Text Item content.
158
* @author S�bastien Lao�t
160
class ItemTextEditWidget : public ItemEditWidgetBase
164
ItemTextEditWidget(Item *item, QWidget *parent = 0, const char *name = 0, WFlags fl = 0, QKeyEvent *ke = 0L);
165
~ItemTextEditWidget();
171
ItemTextEditor *m_editor;
174
/** Editor to edit Rich text Item content.
175
* @author S�bastien Lao�t
177
class ItemHtmlEditor : public ItemEditorBase
181
ItemHtmlEditor(Item *item, QWidget *toolbarParent, QWidget *widgetsParent, QKeyEvent *ke = 0L);
187
// void slotShowSource(bool on);
188
void cursorPositionChanged(int, int);
189
void buttonToggled(int);
190
void slotVerticalAlignmentChanged(QTextEdit::VerticalAlignment align);
192
void slotEscapePressed();
194
FocusedTextEdit *m_text;
195
FocusedFontCombo *m_font;
196
FocusedColorCombo *m_color;
197
// QCheckBox *m_showHtmlSource;
200
// QTextView : The text edit may be able to provide some meta-information.
201
// For example, the documentTitle() function will return the text from within HTML <title> tags.
204
/** The widget to edit Html Item content.
205
* FIXME: The same as ItemTextEditWidget : merge ?
206
* @author S�bastien Lao�t
208
class ItemHtmlEditWidget : public ItemEditWidgetBase
212
ItemHtmlEditWidget(Item *item, QWidget *parent = 0, const char *name = 0, WFlags fl = 0, QKeyEvent *ke = 0L);
213
~ItemHtmlEditWidget();
219
ItemHtmlEditor *m_editor;
222
/** The widget to edit Link Item content.
223
* @author S�bastien Lao�t
225
class ItemLinkEditWidget : public ItemEditWidgetBase
229
ItemLinkEditWidget(Item *item, QWidget *parent = 0, const char *name = 0, WFlags fl = 0, QKeyEvent *ke = 0L);
230
~ItemLinkEditWidget();
235
void urlChanged(const QString&);
236
void doNotAutoTitle(const QString&);
237
void doNotAutoIcon(QString);
243
bool m_isAutoModified;
244
KURLRequester *m_url;
247
QPushButton *m_autoTitle;
248
QPushButton *m_autoIcon;
251
/** The widget to edit Launcher Item content.
252
* @author S�bastien Lao�t
254
class ItemLauncherEditWidget : public ItemEditWidgetBase
258
ItemLauncherEditWidget(Item *item, QWidget *parent = 0, const char *name = 0, WFlags fl = 0);
259
~ItemLauncherEditWidget();
268
bool m_isAutoModified;
269
RunCommandRequester *m_command;
275
/** The widget to edit Image Item content.
276
* @author S�bastien Lao�t
278
class ItemImageEditWidget : public ItemEditWidgetBase
282
ItemImageEditWidget(Item *item, QWidget *parent = 0, const char *name = 0, WFlags fl = 0);
283
~ItemImageEditWidget();
291
/** The widget to edit Color Item content.
292
* @author S�bastien Lao�t
294
class ItemColorEditWidget : public ItemEditWidgetBase
298
ItemColorEditWidget(Item *item, QWidget *parent = 0, const char *name = 0, WFlags fl = 0);
299
~ItemColorEditWidget();
305
KColorButton *m_color;
308
/** Widget to edit annotations of a Item, and check it.
309
* @author S�bastien Lao�t
311
class ItemEditWidget : public ItemEditWidgetBase
315
ItemEditWidget(Item *item, QWidget *parent = 0, const char *name = 0, WFlags fl = 0);
323
KTextEdit *m_annotations;
325
QLineEdit *m_fileName;
326
QPushButton *m_unmirror;
329
/** Show a dialog with tabs to edit Item properties.
330
* @author S�bastien Lao�t
332
class ItemEditDialog : public KDialogBase//QTabDialog
336
ItemEditDialog(Item *item, bool editAnnotations = false, QWidget *parent = 0L, QKeyEvent *ke = 0L);
344
ItemEditWidgetBase *m_editContent;
345
ItemEditWidget *m_itemEdit;