kxmlcommanddlg.h

00001 /*
00002  *  This file is part of the KDE libraries
00003  *  Copyright (c) 2001 Michael Goffioul <kdeprint@swing.be>
00004  *
00005  *  This library is free software; you can redistribute it and/or
00006  *  modify it under the terms of the GNU Library General Public
00007  *  License version 2 as published by the Free Software Foundation.
00008  *
00009  *  This library is distributed in the hope that it will be useful,
00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  *  Library General Public License for more details.
00013  *
00014  *  You should have received a copy of the GNU Library General Public License
00015  *  along with this library; see the file COPYING.LIB.  If not, write to
00016  *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  *  Boston, MA 02110-1301, USA.
00018  **/
00019 
00020 #ifndef KXMLCOMMANDDLG_H
00021 #define KXMLCOMMANDDLG_H
00022 
00023 #include <qwidget.h>
00024 #include <qmap.h>
00025 #include <qstringlist.h>
00026 #include <kdialogbase.h>
00027 
00028 class KListView;
00029 class QListViewItem;
00030 class QLineEdit;
00031 class QComboBox;
00032 class QWidgetStack;
00033 class QToolButton;
00034 class KListBox;
00035 class QListBoxItem;
00036 class QTextEdit;
00037 class QCheckBox;
00038 
00039 class DrGroup;
00040 class DrBase;
00041 class KXmlCommand;
00042 
00043 class KXmlCommandAdvancedDlg : public QWidget
00044 {
00045     Q_OBJECT
00046 public:
00047     KXmlCommandAdvancedDlg(QWidget *parent = 0, const char *name = 0);
00048     ~KXmlCommandAdvancedDlg();
00049 
00050     void setCommand(KXmlCommand*);
00051     static bool editCommand(KXmlCommand *xmlcmd, QWidget *parent = 0);
00052 
00053 protected:
00054     void parseGroupItem(DrGroup*, QListViewItem*);
00055     void parseXmlCommand(KXmlCommand*);
00056     void viewItem(QListViewItem*);
00057     void removeItem(QListViewItem*);
00058     void recreateGroup(QListViewItem*, DrGroup*);
00059 
00060 protected slots:
00061     void slotSelectionChanged(QListViewItem*);
00062     void slotTypeChanged(int);
00063     void slotAddValue();
00064     void slotRemoveValue();
00065     void slotApplyChanges();
00066     void slotAddGroup();
00067     void slotAddOption();
00068     void slotRemoveItem();
00069     void slotMoveUp();
00070     void slotMoveDown();
00071     void slotCommandChanged(const QString&);
00072     void slotValueSelected(QListViewItem*);
00073     void slotOptionRenamed(QListViewItem*, int);
00074     void slotChanged();
00075 
00076 private:
00077     KListView   *m_view;
00078     QLineEdit   *m_name, *m_desc, *m_format, *m_default, *m_command;
00079     QComboBox   *m_type;
00080     QWidget     *m_dummy;
00081     KListView   *m_values;
00082     QLineEdit   *m_edit1, *m_edit2;
00083     QWidgetStack    *m_stack;
00084     QToolButton *m_apply, *m_addgrp, *m_addopt, *m_delopt, *m_up, *m_down;
00085     QLineEdit   *m_inputfile, *m_inputpipe, *m_outputfile, *m_outputpipe;
00086     QToolButton *m_addval, *m_delval;
00087     QTextEdit *m_comment;
00088     QCheckBox *m_persistent;
00089 
00090     KXmlCommand *m_xmlcmd;
00091     QMap<QString, DrBase*>  m_opts;
00092 };
00093 
00094 class KXmlCommandDlg : public KDialogBase
00095 {
00096     Q_OBJECT
00097 public:
00098     KXmlCommandDlg(QWidget *parent = 0, const char *name = 0);
00099 
00100     void setCommand(KXmlCommand*);
00101     static bool editCommand(KXmlCommand*, QWidget *parent = 0);
00102 
00103 protected slots:
00104     void slotAddMime();
00105     void slotRemoveMime();
00106     void slotEditCommand();
00107     void slotAddReq();
00108     void slotRemoveReq();
00109     void slotReqSelected(QListViewItem*);
00110     void slotAvailableSelected(QListBoxItem*);
00111     void slotSelectedSelected(QListBoxItem*);
00112     void slotOk();
00113 
00114 private:
00115     QLineEdit   *m_description;
00116     QLabel      *m_idname;
00117     QComboBox   *m_mimetype;
00118     KListBox    *m_availablemime, *m_selectedmime;
00119     QToolButton *m_addmime, *m_removemime;
00120     KListView   *m_requirements;
00121     QToolButton *m_removereq, *m_addreq;
00122 
00123     QStringList m_mimelist;
00124     KXmlCommand *m_cmd;
00125 };
00126 
00127 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys