1 /***************************************************************************
2 * Copyright (C) 2003 by Sébastien Laoût *
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 ***************************************************************************/
21 #ifndef NEWBASKETDIALOG_H
22 #define NEWBASKETDIALOG_H
24 #include <kdialogbase.h>
25 #include <kiconview.h>
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
45 SingleSelectionKIconView(QWidget
*parent
= 0, const char *name
= 0, WFlags f
= 0);
46 Q3DragObject
* dragObject();
47 Q3IconViewItem
* selectedItem() { return m_lastSelected
; }
49 void slotSelectionChanged(Q3IconViewItem
*item
);
50 void slotSelectionChanged();
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
65 QString backgroundImage
;
66 QColor backgroundColor
;
71 NewBasketDefaultProperties();
74 /** The dialog to create a new basket from a template.
75 * @author Sébastien Laoût
77 class NewBasketDialog
: public KDialogBase
81 NewBasketDialog(Basket
*parentBasket
, const NewBasketDefaultProperties
&defaultProperties
, QWidget
*parent
= 0);
87 void manageTemplates();
88 void nameChanged(const QString
&newName
);
90 int populateBasketsList(Q3ListViewItem
*item
, int indent
, int index
);
91 NewBasketDefaultProperties m_defaultProperties
;
94 KColorCombo2
*m_backgroundColor
;
95 KIconView
*m_templates
;
96 QComboBox
*m_createIn
;
97 QMap
<int, Basket
*> m_basketsMap
;
100 #endif // NEWBASKETDIALOG_H