Ran qt3to4
[basket4.git] / src / newbasketdialog.h
blobb1a893dde2339926510ef90f8a2ccfcaacfb58cb
1 /***************************************************************************
2 * Copyright (C) 2003 by Sébastien Laoût *
3 * slaout@linux62.org *
4 * *
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. *
9 * *
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. *
14 * *
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 ***************************************************************************/
21 #ifndef NEWBASKETDIALOG_H
22 #define NEWBASKETDIALOG_H
24 #include <kdialogbase.h>
25 #include <kiconview.h>
26 #include <qmap.h>
28 class KIconButton;
29 class QLineEdit;
30 class Q3DragObject;
31 class Q3ListViewItem;
33 class Basket;
35 class KColorCombo2;
37 /** The class KIconView allow to drag items. We don't want to, so we disable it.
38 * This class also unselect the selected item when the user right click an empty space. We don't want to, so we reselect it if that happens.
39 * @author Sébastien Laoût
41 class SingleSelectionKIconView : public KIconView
43 Q_OBJECT
44 public:
45 SingleSelectionKIconView(QWidget *parent = 0, const char *name = 0, WFlags f = 0);
46 Q3DragObject* dragObject();
47 Q3IconViewItem* selectedItem() { return m_lastSelected; }
48 private slots:
49 void slotSelectionChanged(Q3IconViewItem *item);
50 void slotSelectionChanged();
51 private:
52 Q3IconViewItem *m_lastSelected;
55 /** Struct to store default properties of a new basket.
56 * When the dialog shows up, the @p icon is used, as well as the @p backgroundColor.
57 * A template is choosen depending on @p freeLayout and @p columnLayout.
58 * If @p columnLayout is too high, the template with the more columns will be chosen instead.
59 * If the user change the background color in the dialog, then @p backgroundImage and @p textColor will not be used!
60 * @author Sébastien Laoût
62 struct NewBasketDefaultProperties
64 QString icon;
65 QString backgroundImage;
66 QColor backgroundColor;
67 QColor textColor;
68 bool freeLayout;
69 int columnCount;
71 NewBasketDefaultProperties();
74 /** The dialog to create a new basket from a template.
75 * @author Sébastien Laoût
77 class NewBasketDialog : public KDialogBase
79 Q_OBJECT
80 public:
81 NewBasketDialog(Basket *parentBasket, const NewBasketDefaultProperties &defaultProperties, QWidget *parent = 0);
82 ~NewBasketDialog();
83 void polish();
84 protected slots:
85 void slotOk();
86 void returnPressed();
87 void manageTemplates();
88 void nameChanged(const QString &newName);
89 private:
90 int populateBasketsList(Q3ListViewItem *item, int indent, int index);
91 NewBasketDefaultProperties m_defaultProperties;
92 KIconButton *m_icon;
93 QLineEdit *m_name;
94 KColorCombo2 *m_backgroundColor;
95 KIconView *m_templates;
96 QComboBox *m_createIn;
97 QMap<int, Basket*> m_basketsMap;
100 #endif // NEWBASKETDIALOG_H