Ananas Library  0.9.5
eactionbutton.ui.h
1 /****************************************************************************
2 ** $Id: eactionbutton.ui.h,v 1.10 2007/04/19 07:30:49 gr Exp $
3 **
4 ** Code file of the edit catalogue plugin of Ananas
5 ** Designer and Engine applications
6 **
7 ** Created : 20031201
8 **
9 ** Copyright (C) 2003-2004 Leader InfoTech. All rights reserved.
10 **
11 ** This file is part of the Ananas Plugins of the Ananas
12 ** automation accounting system.
13 **
14 ** This file may be distributed and/or modified under the terms of the
15 ** GNU General Public License version 2 as published by the Free Software
16 ** Foundation and appearing in the file LICENSE.GPL included in the
17 ** packaging of this file.
18 **
19 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
20 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
21 **
22 ** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
23 ** See http://www.leaderit.ru/gpl/ for GPL licensing information.
24 **
25 ** Contact org@leaderit.ru if any conditions of this licensing are
26 ** not clear to you.
27 **
28 **********************************************************************/
29 /****************************************************************************
30 ** ui.h extension file, included from the uic-generated form implementation.
31 **
32 ** If you wish to add, delete or rename functions or slots use
33 ** Qt Designer which will update this file, preserving your code. Create an
34 ** init() function in place of a constructor, and a destroy() function in
35 ** place of a destructor.
36 *****************************************************************************/
37 #include <qseditor.h>
38 #include <stdlib.h>
39 
40 void eActionButton::Action_toggled( bool o )
41 {
42  Script->setChecked( !o );
43  //else
44 }
45 
46 
47 void eActionButton::Script_toggled( bool o )
48 {
49  Action->setChecked( !o );
50 }
51 
52 void eActionButton::setData( wActionButton *b )
53 {
54  if ( !b ) return;
55  if ( b->isAction() ) Action->setChecked( TRUE );
56  if ( b->isActionUpdate() ) cbUpdate->setChecked( TRUE );
57  if ( b->isActionTurnOn() ) cbTurnon->setChecked( TRUE );
58  if ( b->isActionClose() ) cbClose->setChecked( TRUE );
59  if ( b->isScript() ) Script->setChecked( TRUE );
60 // cbAction->setCurrentItem(b->getAction())
61  // eCode->setText( b->getScriptCode() );
62 // button = b;
63  aWidget *wd = aWidget::parentContainer( b );
64  if ( !strcmp(wd->name(),"Catalogue") )
65  {
66  cbTurnon->setChecked( false );
67  cbTurnon->setHidden( TRUE );
68 
69 // b->setActionTurnOn( FALSE );
70  }
71  aCfg *md = wd->getMd();
72  QStringList l_name;
73  aCfgItem parent = md->find(mdc_actions);
74  l_id.clear();
75  loadActions(&l_name, &l_id, parent, md);
76  cbAction->clear();
77  cbAction->insertStringList(l_name);
78  cbAction->setCurrentItem( l_id.findIndex( QString("%1").arg(b->getActionId()) ) );
79 
80 }
81 
82 
83 void eActionButton::getData( wActionButton *button)
84 {
85  if ( !button ) return;
86  button->setAction( Action->isChecked() );
87  button->setActionUpdate( cbUpdate->isChecked() );
88  button->setActionTurnOn( cbTurnon->isChecked() );
89  button->setActionClose( cbClose->isChecked() );
90  button->setScript( Script->isChecked() );
91  button->setActionUpdate( cbUpdate->isChecked() );
92  if(cbAction->isEnabled())
93  {
94 
95  button->setActionId ( atoi(l_id[cbAction->currentItem()].ascii()));
96  }
97  else
98  {
99  button->setActionId(0);
100  }
101 // button->setScriptCode( eCode->text() );
102 }
103 
104 void eActionButton::destroy()
105 {
106  //getData();
107 }
108 
109 
110 void
111 eActionButton::loadActions( QStringList *lst, QStringList *id, aCfgItem p, aCfg *md )
112 {
113  aCfgItem cobj;
114  QString oclass;
115  if(p.isNull())
116  {
117  p = md->find(mdc_actions);
118  // printf("parent were NULL, set parent to %s\n",md->objClass(p).ascii());
119  }
120 
121  if(p.isNull()) return;
122  cobj = md->firstChild ( p );
123  while ( !cobj.isNull() )
124  {
125  oclass = md->objClass ( cobj );
126  if ( oclass == md_actiongroup )
127  loadActions ( lst, id, cobj, md );
128  if ( oclass == md_action )
129  {
130  lst->append(md->attr(cobj,mda_name));
131  id->append(md->attr(cobj,mda_id));
132  }
133  cobj = md->nextSibling ( cobj );
134  }
135 }
aCfgItem firstChild(aCfgItem context)
Definition: acfg.cpp:796
aCfgItem nextSibling(aCfgItem context)
Definition: acfg.cpp:820
Класс реализует програмный интерфейс доступа к элемен...
Definition: acfg.h:436
QString attr(aCfgItem context, const QString &name)
Definition: acfg.cpp:992
Definition: wactionbutton.h:39
QString objClass(long id)
Definition: acfg.cpp:966
Базовый класс для визуальных объектов. Наследует QWidget...
Definition: awidget.h:52
aCfgItem find(aCfgItem context, const QString &name, int n=0)
Definition: acfg.cpp:539
aCfg * getMd()
Definition: awidget.cpp:416