summaryrefslogtreecommitdiffstats
path: root/kopete/libkopete/ui/kopetepasswordwidget.h
blob: 902dfd4c1be4c53133872f9e7c76c59f40c5eac2 (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
/*
    kopetepasswordwidget.cpp - widget for editing a Kopete::Password

    Copyright (c) 2003 by Richard Smith          <[email protected]>

    Kopete    (c) 2003 by the Kopete developers  <[email protected]>

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

#ifndef KOPETEPASSWORDWIDGET_H
#define KOPETEPASSWORDWIDGET_H

#include "kopetepasswordwidgetbase.h"
#include "kopete_export.h"

namespace Kopete
{

class Password;

namespace UI
{

/**
 * @author Richard Smith <[email protected]>
 * This widget displays an editable password, including the Remember password checkbox.
 * @todo This is NOT BC yet : it derives from a uic-generated class
 */
class KOPETE_EXPORT PasswordWidget : public KopetePasswordWidgetBase
{
	TQ_OBJECT
  

public:
	/**
	 * Creates a Kopete::PasswordWidget.
	 * @param parent The widget to nest this one inside
	 * @param name The name of this TQObject
	 * @param from The password to load the data for this widget from, or 0 if none
	 */
	PasswordWidget( TQWidget *parent, const char *name = 0, Kopete::Password *from = 0 );
	~PasswordWidget();

	/**
	 * Loads the information stored in source into the widget
	 */
	void load( Kopete::Password *source );
	/**
	 * Saves the information in the widget into target
	 */
	void save( Kopete::Password *target );

	/**
	 * Returns true if the information in the widget is valid, false if it is not.
	 * Currently the only way this can fail is if the password is too long.
	 * @todo this should return an enum of failures.
	 */
	bool validate();

	/**
	 * Returns the string currently in the input box in the widget
	 */
	TQString password() const;
	/**
	 * Returns a boolean indicating whether the Remember Password checkbox is checked.
	 * Result is undefined if the Remember Password field is in the 'no change' state
	 * because the user has not (yet) opened the wallet.
	 */
	bool remember() const;
	
	/**
	 * Set the password stored in the widget.
	 * @param pass The text to place in the password field.
	 */
	void setPassword( const TQString &pass );

signals:
	/**
	 * Emitted when the information stored in this widget changes
	 */
	void changed();

public slots:
	/** @internal */
	void receivePassword( const TQString & );

private slots:
	void slotRememberChanged();

private:
	class Private;
	Private *d;
};

}

}

#endif