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)
32 group->Title=handle->title();
33 group->Image=handle->image();
34 connect( ButtonBox, SIGNAL( accepted() ), this, SLOT( OnOK() ) );
35 connect( ButtonBox, SIGNAL( rejected() ), this, SLOT( OnCancel() ) );
36 connect( Button_Icon, SIGNAL( clicked() ), this, SLOT( OnIconDlg() ));
38 setMaximumSize(size());
39 setMinimumSize(size());
43 CEditGroupDialog::CEditGroupDialog(IDatabase* database,CGroup* Group,QWidget* parent, Qt::WFlags fl)
50 connect( ButtonBox, SIGNAL( accepted() ), this, SLOT( OnOK() ) );
51 connect( ButtonBox, SIGNAL( rejected() ), this, SLOT( OnCancel() ) );
52 connect( Button_Icon, SIGNAL( clicked() ), this, SLOT( OnIconDlg() ));
55 CEditGroupDialog::~CEditGroupDialog(){
58 void CEditGroupDialog::showEvent(QShowEvent *event){
59 if(event->spontaneous()==false){
60 EditTitle->setText(group->Title);
61 for(int i=0;i<db->numIcons();i++){
62 ComboIconPicker->insertItem(i,db->icon(i),"");
64 ComboIconPicker->setCurrentIndex(group->Image);
68 void CEditGroupDialog::OnOK()
71 if(EditTitle->text()!=group->Title){
72 group->Title=EditTitle->text();
75 if(ComboIconPicker->currentIndex()!=group->Image){
76 group->Image=ComboIconPicker->currentIndex();
80 handle->setTitle(group->Title);
81 handle->setImage(group->Image);
86 void CEditGroupDialog::OnCancel()
92 void CEditGroupDialog::OnIconDlg(){
93 CSelectIconDlg dlg(db,group->Image,this);
96 ComboIconPicker->clear();
97 for(int i=0;i<db->numIcons();i++)
98 ComboIconPicker->insertItem(i,db->icon(i),"");
100 ComboIconPicker->setCurrentIndex(r);