gwenhywfar  4.8.0beta
qt4dialogbox.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  begin : Tue Feb 16 2010
3  copyright : (C) 2010 by Martin Preuss
4  email : martin@libchipcard.de
5 
6  ***************************************************************************
7  * Please see toplevel file COPYING for license details *
8  ***************************************************************************/
9 
10 #ifdef HAVE_CONFIG_H
11 # include <config.h>
12 #endif
13 
14 
15 
16 #include "qt4dialogbox.hpp"
17 #include "qt4_gui_dialog.hpp"
18 
19 #include <QCloseEvent>
20 
21 #include <gwenhywfar/debug.h>
22 
23 
24 
25 
27  QWidget *parent,
28  bool modal,
29  Qt::WindowFlags f)
30 :QDialog(parent, f)
31 ,_dialog(dialog)
32 {
33  setModal(modal);
34 }
35 
36 
37 
39 }
40 
41 
42 
44  QDialog::accept();
45 }
46 
47 
48 
50  QDialog::reject();
51 }
52 
53 
54 
56  return exec();
57 }
58 
59 
60 
61 void QT4_DialogBox::closeEvent(QCloseEvent *e){
62  if (_dialog) {
63  int rv;
64 
67  e->accept();
68  }
69  }
70  else {
71  e->accept();
72  }
73 }
74 
75 
76 
78  _dialog=NULL;
79 }
80 
81 
82 
84  const QObject *snd;
85 
86  snd=sender();
87  if (snd) {
88  GWEN_WIDGET *w;
89  const char *wname;
91 
93  if (w==NULL) {
94  DBG_INFO(0, "Widget not found");
95  return;
96  }
97  wname=GWEN_Widget_GetName(w);
98 
99  DBG_INFO(GWEN_LOGDOMAIN, "Command for [%s] (type: %s)",
100  wname?wname:"(unnamed)",
102 
103  switch(GWEN_Widget_GetType(w)) {
106  break;
107 
119  break;
136  /* nothing to do for these types */
137  ;
138  }
139 
141  accept();
142  }
143  else if (rv==GWEN_DialogEvent_ResultReject) {
144  reject();
145  }
146  }
147 }
148 
149 
150 
152  const QObject *snd;
153 
154  snd=sender();
155  if (snd) {
156  GWEN_WIDGET *w;
157  const char *wname;
159 
161  if (w==NULL) {
162  DBG_INFO(0, "Widget not found");
163  return;
164  }
165  wname=GWEN_Widget_GetName(w);
166 
167  DBG_INFO(GWEN_LOGDOMAIN, "ValueChanged for [%s] (type: %s)",
168  wname?wname:"(unnamed)",
170 
171  switch(GWEN_Widget_GetType(w)) {
174  break;
175 
187  break;
188 
205  /* nothing to do for these types */
206  ;
207  }
208 
210  accept();
211  }
212  else if (rv==GWEN_DialogEvent_ResultReject) {
213  reject();
214  }
215  }
216 }
217 
218 
219 
220 #include "qt4dialogbox.moc"
221 
222 
223