summaryrefslogtreecommitdiffstats
path: root/kdeprint/management/kxmlcommanddlg.h
blob: f30b321ad06d1f2c933e358ff2eafe039d71c649 (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
/*
 *  This file is part of the KDE libraries
 *  Copyright (c) 2001 Michael Goffioul <kdeprint@swing.be>
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Library General Public
 *  License version 2 as published by the Free Software Foundation.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Library General Public License for more details.
 *
 *  You should have received a copy of the GNU Library General Public License
 *  along with this library; see the file COPYING.LIB.  If not, write to
 *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 *  Boston, MA 02110-1301, USA.
 **/

#ifndef KXMLCOMMANDDLG_H
#define KXMLCOMMANDDLG_H

#include <tqwidget.h>
#include <tqmap.h>
#include <tqstringlist.h>
#include <kdialogbase.h>

class KListView;
class TQListViewItem;
class TQLineEdit;
class TQComboBox;
class TQWidgetStack;
class TQToolButton;
class KListBox;
class TQListBoxItem;
class TQTextEdit;
class TQCheckBox;

class DrGroup;
class DrBase;
class KXmlCommand;

class KXmlCommandAdvancedDlg : public QWidget
{
	Q_OBJECT
public:
	KXmlCommandAdvancedDlg(TQWidget *parent = 0, const char *name = 0);
	~KXmlCommandAdvancedDlg();

	void setCommand(KXmlCommand*);
	static bool editCommand(KXmlCommand *xmlcmd, TQWidget *parent = 0);

protected:
	void parseGroupItem(DrGroup*, TQListViewItem*);
	void parseXmlCommand(KXmlCommand*);
	void viewItem(TQListViewItem*);
	void removeItem(TQListViewItem*);
	void recreateGroup(TQListViewItem*, DrGroup*);

protected slots:
	void slotSelectionChanged(TQListViewItem*);
	void slotTypeChanged(int);
	void slotAddValue();
	void slotRemoveValue();
	void slotApplyChanges();
	void slotAddGroup();
	void slotAddOption();
	void slotRemoveItem();
	void slotMoveUp();
	void slotMoveDown();
	void slotCommandChanged(const TQString&);
	void slotValueSelected(TQListViewItem*);
	void slotOptionRenamed(TQListViewItem*, int);
	void slotChanged();

private:
	KListView	*m_view;
	QLineEdit	*m_name, *m_desc, *m_format, *m_default, *m_command;
	QComboBox	*m_type;
	QWidget		*m_dummy;
	KListView	*m_values;
	QLineEdit	*m_edit1, *m_edit2;
	QWidgetStack	*m_stack;
	QToolButton	*m_apply, *m_addgrp, *m_addopt, *m_delopt, *m_up, *m_down;
	QLineEdit	*m_inputfile, *m_inputpipe, *m_outputfile, *m_outputpipe;
	QToolButton	*m_addval, *m_delval;
	TQTextEdit *m_comment;
	TQCheckBox *m_persistent;

	KXmlCommand	*m_xmlcmd;
	TQMap<TQString, DrBase*>	m_opts;
};

class KXmlCommandDlg : public KDialogBase
{
	Q_OBJECT
public:
	KXmlCommandDlg(TQWidget *parent = 0, const char *name = 0);

	void setCommand(KXmlCommand*);
	static bool editCommand(KXmlCommand*, TQWidget *parent = 0);

protected slots:
	void slotAddMime();
	void slotRemoveMime();
	void slotEditCommand();
	void slotAddReq();
	void slotRemoveReq();
	void slotReqSelected(TQListViewItem*);
	void slotAvailableSelected(TQListBoxItem*);
	void slotSelectedSelected(TQListBoxItem*);
	void slotOk();

private:
	QLineEdit	*m_description;
	QLabel		*m_idname;
	QComboBox	*m_mimetype;
	KListBox	*m_availablemime, *m_selectedmime;
	QToolButton	*m_addmime, *m_removemime;
	KListView	*m_requirements;
	QToolButton	*m_removereq, *m_addreq;

	QStringList	m_mimelist;
	KXmlCommand	*m_cmd;
};

#endif