Source: attributeeditor.h


Annotated List
Files
Globals
Hierarchy
Index
// ##########################################################################
// ####                                                                  ####
// ####                         Prüfungsamt-Client                       ####
// ####                    ============================                  ####
// ####                                                                  ####
// #### Attribut-Editor                                                  ####
// ####                                                                  ####
// #### Version 1.00  --  25. Juni 2000                                  ####
// ####                                                                  ####
// #### Copyright (C) 2000  Thomas Dreibholz                             ####
// ####                     Universität Bonn                             ####
// ####                     EMail: Dreibholz@bigfoot.com                 ####
// ####                     WWW:   http://www.bigfoot.com/~dreibholz     ####
// ####                                                                  ####
// ##########################################################################


#ifndef ATTRIBUTEEDITOR_H
#define ATTRIBUTEEDITOR_H


#include "system.h"
#include "paclient.h"
#include "paviews.h"
#include "tableviewer.h"


#include <qapp.h>
#if QT_VERSION < 210
#error ERROR: QT Version 2.1 or better required!!!
#endif
#include <qstring.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qlist.h>


class TableViewer;
class TupleEditor;


class AttributeEditor : public QWidget
{
   Q_OBJECT

   // ====== Constructor/Destructor =========================================
   public:
   /**
     * Constructor.
     *
     * @param connection Datenbank-Verbindung.
     * @param view ViewEntry des Attributes.
     * @param editable Ist Wert editierbar?
     * @param value Startwert.
     * @param parent Parent QWidget; default: NULL.
     * @param name Widget-Name; default: NULL.
     */
   AttributeEditor(SQLConnectionInterface* connection,
                   const ViewEntry*        view,
                   const QString&          attribute,
                   const bool              editable = true,
                   const QString&          value    = QString::null,
                   QWidget*                parent   = NULL,
                   const char*             name     = NULL);

   /**
     * Destructor.
     */
   ~AttributeEditor();


   // ====== Attributwerte-Manipulation =====================================
   /**
     * Wert des Attributes zurückgeben.
     *
     * @return Attributwert.
     */
   QString getValue() const;

   /**
     * Wert des Attributes setzen
     *
     * @param value Attributwert.
     */
   void setValue(const QString& value);

   /**
     * Eingabe markieren (z.B. nach Update-Fehler).
     */
   void mark();


   // ====== Slots für Qt ===================================================
   public slots:
   /**
     * Qt-Slot: Return in LineEdit gedrückt.
     */
   void returnPressed();

   /**
     * Qt-Slot: "Auswahl..."-Button angeklickt.
     */
   void clicked();

   /**
     * Qt-Slot: Wert ComboBox gewählt.
     */
   void activated(int number);

   /**
     * Qt-Slot: Selektion durchgeführt.
     */
   void valueSelected(TableViewer* viewer, const bool selected, const QString& selection);


   // ====== Signale für Qt =================================================
   signals:
   /**
     * Qt-Signal: Wert-Eingabe in LineEdit mit Return beendet.
     */
   void userUpdate();


   // ====== Private Daten ==================================================
   private:
   struct ValueListEntry {
      QString Key;
      QString Value;
   };


   QString fetchTuple(const QString& tableName,
                      const QString& attributes,
                      const QString& key,
                      const QString& keyValue);
   QList<ValueListEntry>* fetchValueList(const QString& tableName,
                                         const QString& attributes,
                                         const QString& key);

   SQLConnectionInterface* Connection;
   const ViewEntry*        View;
   QString                 Attribute;
   QLineEdit*              LineEdit;
   QLabel*                 Label;
   QComboBox*              ComboBox;
   QPushButton*            Button;

   TableViewer*            Selector;
   const ViewTable*        SelectView;
   QString                 SelectValue;
   QString                 SelectAttribute;
   QString                 SelectInfoAttributes;
   QList<ValueListEntry>*  SelectList;
};


#endif

Generated by: viper@odin on Wed Jul 12 17:11:55 2000, using kdoc 2.0a22.