summaryrefslogtreecommitdiffstats
path: root/src/knutrwvar.h
blob: 67a5b4c02977bef9bdff5b7d75e235563391cf36 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
/***************************************************************************
                          knutrwvar.h  -  description
                             -------------------
    begin                : So ríj 26 2002
    copyright            : (C) 2002 by Daniel Prynych
    email                : Daniel.Prynych@alo.cz
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef KNUTRWVAR_H
#define KNUTRWVAR_H

#include "knutnet.h"

#include <kdialogbase.h>
#include <klineedit.h>
#include <tdelocale.h>
#include <kcombobox.h>


class TQString;
class TQGridLayout;

/**
 * This class is graphics interface for changes of RW variables.
 * Tato trida je graficke rozhrani pro zmenu RW promennych.
 *
 * @author Daniel Prynych
 * @short RW promenne
 * @version 0.2
*/
class KNutRWVar : public KDialogBase  {
  Q_OBJECT
  
  public: 
/**
 * Constructor - makes window for change of RW variable.
 * Konstruktor - vytvori okno pro zmenu RW promene.
 *

 * @param uName Describes user name.
 * @param password Describes password.
 * @param initUpsNet is pointer of intance of class KNutNet.
 * @param userName Urcuje uzivatelske jmeno.
 * @param userPassword Urcuje heslo.
 * @param uName Urcuje uzivatelske jmeno.
 * @param password Urcuje heslo.
 * @param initUpsNet Je odkaz na instanci tridy KNutNet.
 * @since  0.2
 **/
  KNutRWVar(TQString* userName, TQString* userPassword, const TQString uName, const TQString password, KNutNet* const initUpsNet, TQWidget* parent = 0, const char* name = 0, const bool modal = TRUE);

/**
 * Destructor
 *
 * @since  0.2
 **/
  ~KNutRWVar();

/**
 * Vraci true pokud existuje pripojeni na server a vytvorilo se
 * ovladaci okno pro nastaveni promennych.
 *
 * @since  0.3
 **/
  bool upsOk (void);


  private slots:

/**
 * @internal
 *
 * Nastavi hodnotu a zpusob vyberu hodnoty promenne.
 */
  void slotChangeVar(int item);

/**
 * @internal
 *
 * Sets value of variable on default value
 * Nastavi hodnotu promenne na puvodni hodnotu.
 */
  virtual void slotDefault ();

/**
 * @internal
 *
 * Provede akci
 */
  virtual void slotOk();



/**
 * @internal
 *
 * Find asked item in box
 * Since at version 3.0.0 is not needed. 
 * Najde pozadovanou polozku v boxu.
 * Ve verzi qt > 3.0.0 neni potreba.
 */
int findItem(const KComboBox *myBox ,const TQString text);

  signals:
/**
 * Signal je aktivovam pokud je zmenen udaj na kterekoliv strance.
 *
 * @param changeSetting Udava co bylo zmeneno.
 *
 * @since  0.1
 **/
  void signalChangeRWVars (TQString varName);


  private:
  KNutNet* m_upsNet;
  KLineEdit *m_lineEditName;
  KLineEdit *m_lineEditPassword;
  KComboBox *m_rWVarBox;
  KComboBox *m_valueVarBox;
  KLineEdit *m_valueVarLine;
  TQGridLayout *m_passLayout;
  bool m_upsValueType;
  bool m_upsConnectOk;

  TQString* m_oldUserName;
  TQString* m_oldUserPassword;


  };

#endif