summaryrefslogtreecommitdiffabout
path: root/pwmanager/pwmanager/pwgenwnd_emb.cpp
blob: 21e0af4fcc7094436bfd06d1ee611f3c0b2dd007 (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
128
129
130
131
132
133
134
135
136
137
/*                                                                      
    This file is part of PwManager/Platform independent.                                  
    Copyright (c) 2004 Ulf Schenk
                                                                        
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or   
    (at your option) any later version.                                 
                                                                        
    This program 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 General Public License for more details.                        
                                                                        
    You should have received a copy of the GNU General Public License   
    along with this program; if not, write to the Free Software         
    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.           
                                                                        
    As a special exception, permission is given to link this program    
    with any edition of Qt, and distribute the resulting executable,    
    without including the source code for Qt in the source distribution.

$Id$
*/                                                                      

#include "pwgenwnd_emb.h"

#include <qpushbutton.h>
#include <q3groupbox.h>
#include <qcheckbox.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qspinbox.h>
#include <qlayout.h>
//Added by qt3to4:
#include <Q3HBoxLayout>
#include <Q3VBoxLayout>

#include "klocale.h"

/*
 *  Constructs a pwGenWnd as a child of 'parent', with the
 *  name 'name'.
 *
 */
pwGenWnd::pwGenWnd( QWidget* parent, const char* name)
  : KDialogBase( KDialogBase::Plain, i18n( "Password generator" ), 
                 KDialogBase::Ok | KDialogBase::Cancel,
                 KDialogBase::Ok, parent, name, true )
{
    QWidget *page = plainPage();
    Q3VBoxLayout* pwGenWndLayout = new Q3VBoxLayout( page, 11, 6, "pwGenWndLayout"); 

    Q3GroupBox* groupBox1 = new Q3GroupBox( page, "groupBox1" );
    groupBox1->setTitle( i18n( "Character set:" ) );
    groupBox1->setColumnLayout(0, Qt::Vertical );
    groupBox1->layout()->setSpacing( 6 );
    groupBox1->layout()->setMargin( 11 );
    Q3VBoxLayout* groupBox1Layout = new Q3VBoxLayout( groupBox1->layout() );
    groupBox1Layout->setAlignment( Qt::AlignTop );

    int_charLowerCheckBox = new QCheckBox( i18n("Lowercase (abc)"), groupBox1, "int_charLowerCheckBox" );
    int_charLowerCheckBox->setChecked( TRUE );
    groupBox1Layout->addWidget( int_charLowerCheckBox );

    int_charUpperCheckBox = new QCheckBox( i18n("Uppercase (ABC)"), groupBox1, "int_charUpperCheckBox" );
    int_charUpperCheckBox->setChecked( TRUE );
    groupBox1Layout->addWidget( int_charUpperCheckBox );


    int_charNumCheckBox = new QCheckBox( i18n("Numbers (123)"), groupBox1, "int_charNumCheckBox" );
    int_charNumCheckBox->setChecked( TRUE );
    groupBox1Layout->addWidget( int_charNumCheckBox );

    int_charSpecCheckBox = new QCheckBox( i18n("Special characters:"), groupBox1, "int_charSpecCheckBox" );
    groupBox1Layout->addWidget( int_charSpecCheckBox );

    QLabel* textLabel7 = new QLabel( groupBox1, "textLabel7" );
    QString st("\x21\x22\xc2\xa7\x24\x25\x26\x2f\x28\x29\x3d\x3f\x2c\x2e\x2d\x3b\x3a\x5f\x2b");
    textLabel7->setText( st.utf8() );
    groupBox1Layout->addWidget( textLabel7 );

    int_charBlankCheckBox = new QCheckBox( i18n( "Spaces (blank characters)"), groupBox1, "int_charBlankCheckBox" );
    groupBox1Layout->addWidget( int_charBlankCheckBox );

    Q3HBoxLayout* layout7 = new Q3HBoxLayout( 0, 0, 6, "layout7"); 

    int_charUserCheckBox = new QCheckBox( i18n("User defined:"), groupBox1, "int_charUserCheckBox" );
    layout7->addWidget( int_charUserCheckBox );

    int_userDefLineEdit = new QLineEdit( groupBox1, "int_userDefLineEdit" );
    int_userDefLineEdit->setEnabled( FALSE );
    layout7->addWidget( int_userDefLineEdit );
    groupBox1Layout->addLayout( layout7 );
    pwGenWndLayout->addWidget( groupBox1 );


    Q3HBoxLayout* layout8 = new Q3HBoxLayout( 0, 0, 6, "layout8"); 

    int_lenSpinBox = new QSpinBox( page, "int_lenSpinBox" );
    QLabel* textLabel2 = new QLabel( int_lenSpinBox, i18n("Password Length:"), page, "textLabel2" );
    layout8->addWidget( textLabel2 );

    int_lenSpinBox->setMaxValue( 9999 );
    int_lenSpinBox->setMinValue( 1 );
    int_lenSpinBox->setValue( 8 );
    layout8->addWidget( int_lenSpinBox );
    pwGenWndLayout->addLayout( layout8 );

    int_filterCheckBox = new QCheckBox( i18n( "Enable Filtering to get better passwords" ), page, "int_filterCheckBox" );
    int_filterCheckBox->setChecked( TRUE );
    pwGenWndLayout->addWidget( int_filterCheckBox );

    setButtonText( KDialogBase::Ok, "&Generate now" );

    // signals and slots connections
    connect( int_charUserCheckBox, SIGNAL( toggled(bool) ), int_userDefLineEdit, SLOT( setEnabled(bool) ) );
}

/*
 *  Destroys the object and frees any allocated resources
 */
pwGenWnd::~pwGenWnd()
{
    // no need to delete child widgets, Qt does it all for us
}

void pwGenWnd::cancelButton_slot()
{
    qWarning( "pwGenWnd::cancelButton_slot(): Not implemented yet" );
}

void pwGenWnd::genButton_slot()
{
    qWarning( "pwGenWnd::genButton_slot(): Not implemented yet" );
}