summaryrefslogtreecommitdiffabout
path: root/pwmanager/pwmanager/addentrywndimpl.h
blob: e13eb543d2e99527f35abfce44084245d00e97e5 (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
/***************************************************************************
 *                                                                         *
 *   copyright (C) 2003, 2004 by Michael Buesch                            *
 *   email: mbuesch@freenet.de                                             *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License version 2        *
 *   as published by the Free Software Foundation.                         *
 *                                                                         *
 ***************************************************************************/

/***************************************************************************
 * copyright (C) 2004 by Ulf Schenk
 * This file is originaly based on version 1.0.1 of pwmanager
 * and was modified to run on embedded devices that run microkde
 *
 * $Id$
 **************************************************************************/  

#ifndef __ADDENTRYWNDIMPL_H
#define __ADDENTRYWNDIMPL_H


#ifndef PWM_EMBEDDED
#include <qlineedit.h>
#include <qtextedit.h>
#include <qcombobox.h>
#include "addentrywnd.h"
#else
#include <klineedit.h>
#include <kcombobox.h>
#include <qmultilineedit.h>
#include "addentrywnd_emb.h"
#endif

#include <qpushbutton.h>

class PwGenWndImpl;

/** "add/edit" Window */
class AddEntryWndImpl : public addEntryWnd
{
	Q_OBJECT
public:
#ifndef PWM_EMBEDDED
	AddEntryWndImpl();
#else
	AddEntryWndImpl( PwMDoc* doc, QWidget* parent = 0, const char* name = 0);
#endif
	~AddEntryWndImpl();

	/* get... functions */
	QString getDescription()
			{ return descLineEdit->text(); }
	QString getCategory()
			{ return categoryComboBox->currentText(); }
	QString getUsername()
			{ return usernameLineEdit->text(); }
	QString getPassword()
			{ return pwLineEdit->text(); }
	QString getUrl()
			{ return urlLineEdit->text(); }
	QString getLauncher()
			{ return launcherLineEdit->text(); }
	QString getComment();

	/* set... functions */
	void setDescription(const QString &desc)
			{ descLineEdit->setText(desc); }
	void setCurrCategory(const QString &cat);
	void addCategory(const QString &cat)
			{ categoryComboBox->insertItem(cat); }
	void setUsername(const QString &name)
			{ usernameLineEdit->setText(name); }
	void setPassword(const QString &pw)
			{ pwLineEdit->setText(pw); }
	void setUrl(const QString &url)
			{ urlLineEdit->setText(url); }
	void setLauncher(const QString launcher)
			{ launcherLineEdit->setText(launcher); }
	void setComment(const QString &comm);

	/** are we using an advanced comment */
	bool isAdvancedComment()
			{ return useAdvComment; }

public slots:
#ifndef PWM_EMBEDDED 
//MOC_SKIP_BEGIN
	/** OK button pressed */
	void okButton_slot();
	/** cancel button pressed */
	void cancelButton_slot();
//MOC_SKIP_END
#else
	virtual void slotOk();
#endif
	/** Reveal button pressed */
	void revealButton_slot();
	/** Generate button pressed */
	void generateButton_slot();
	/** advanced comment button pressed */
	void advancedCommentButton_slot(bool on);
	/** edit advanced comment button pressed */
	void editAdvCommentButton_slot();

protected:
	void switchComment(bool toAdvanced);

protected:
	QPushButton *editAdvCommentButton;
#ifndef PWM_EMBEDDED
	QTextEdit *commentTextEdit;
#else
	//nothing here 
#endif
	/** saved data from normal comment text edit box */
	QString savedCommentText;
	/** use an advanced comment? */
	bool useAdvComment;
	/** data of advanced comment (if available) */
	QString advCommentDta;
	/** password generation object */
	PwGenWndImpl *pwGen;
};

#endif