1 /***************************************************************************
2 * Copyright (C) 2005 by Tarek Saidi *
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; version 2 of the License. *
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 ***************************************************************************/
22 #include "EditGroupDlg.h"
23 #include "SelectIconDlg.h"
25 CEditGroupDialog::CEditGroupDialog(IDatabase* database,IGroupHandle* Handle,QWidget* parent, Qt::WFlags fl)
31 group->Title = handle->title();
32 group->Image = handle->image();
38 CEditGroupDialog::CEditGroupDialog(IDatabase* database,CGroup* Group,QWidget* parent, Qt::WFlags fl)
48 CEditGroupDialog::~CEditGroupDialog(){
51 void CEditGroupDialog::init() {
54 connect( ButtonBox, SIGNAL( accepted() ), this, SLOT( OnOK() ) );
55 connect( ButtonBox, SIGNAL( rejected() ), this, SLOT( OnCancel() ) );
56 connect( Button_Icon, SIGNAL( clicked() ), this, SLOT( OnIconDlg() ));
58 EditTitle->setText(group->Title);
60 for(int i=0;i<db->numIcons();i++){
61 ComboIconPicker->insertItem(i,db->icon(i),"");
63 ComboIconPicker->setCurrentIndex(group->Image);
66 setMaximumSize(size());
67 setMinimumSize(size());
71 void CEditGroupDialog::OnOK()
74 if(EditTitle->text()!=group->Title){
75 group->Title=EditTitle->text();
78 if(ComboIconPicker->currentIndex()!=group->Image){
79 group->Image=ComboIconPicker->currentIndex();
83 handle->setTitle(group->Title);
84 handle->setImage(group->Image);
89 void CEditGroupDialog::OnCancel()
95 void CEditGroupDialog::OnIconDlg(){
96 CSelectIconDlg dlg(db,group->Image,this);
99 ComboIconPicker->clear();
100 for(int i=0;i<db->numIcons();i++)
101 ComboIconPicker->insertItem(i,db->icon(i),"");
103 ComboIconPicker->setCurrentIndex(r);