~ubuntu-branches/ubuntu/intrepid/kdesdk/intrepid-updates

« back to all changes in this revision

Viewing changes to kbugbuster/gui/serverconfigdialog.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2008-05-28 10:11:43 UTC
  • mto: This revision was merged to the branch mainline in revision 37.
  • Revision ID: james.westby@ubuntu.com-20080528101143-gzc3styjz1b70zxu
Tags: upstream-4.0.80
ImportĀ upstreamĀ versionĀ 4.0.80

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* This file is part of kdesdk / KBugBuster.
 
2
 
 
3
   Copyright 2008  KBugBuster Authors <kde-ev-board@kde.org>
 
4
 
 
5
   This program is free software; you can redistribute it and/or
 
6
   modify it under the terms of the GNU General Public License as
 
7
   published by the Free Software Foundation; either version 2 of
 
8
   the License or (at your option) version 3 or any later version
 
9
   accepted by the membership of KDE e.V. (or its successor approved
 
10
   by the membership of KDE e.V.), which shall act as a proxy 
 
11
   defined in Section 14 of version 3 of the license.
 
12
 
 
13
   This program is distributed in the hope that it will be useful,
 
14
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
15
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
16
   GNU General Public License for more details.
 
17
 
 
18
   You should have received a copy of the GNU General Public License
 
19
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
20
*/
1
21
#include "serverconfigdialog.h"
2
22
 
3
 
#include "bugserverconfig.h"
 
23
#include <QLayout>
 
24
#include <QLineEdit>
 
25
#include <QLabel>
 
26
#include <q3vbox.h>
 
27
#include <QComboBox>
 
28
#include <QGridLayout>
4
29
 
5
 
#include <kpassdlg.h>
 
30
#include <klineedit.h>
6
31
#include <kdebug.h>
7
32
#include <klocale.h>
8
33
 
9
 
#include <qlayout.h>
10
 
#include <qlineedit.h>
11
 
#include <qlabel.h>
12
 
#include <qvbox.h>
13
 
#include <qcombobox.h>
14
 
 
15
 
ServerConfigDialog::ServerConfigDialog( QWidget *parent, const char *name ) :
16
 
  KDialogBase( parent, name, true, i18n("Edit Bugzilla Server"), Ok|Cancel )
 
34
#include "bugserverconfig.h"
 
35
 
 
36
 
 
37
ServerConfigDialog::ServerConfigDialog( QWidget *parent) :
 
38
  KDialog( parent)
17
39
{
18
 
  QWidget *topFrame = makeMainWidget();
 
40
    setCaption( i18n("Edit Bugzilla Server") );
 
41
    setButtons( Ok|Cancel );
 
42
    setDefaultButton( Ok );
 
43
    setModal( true );
 
44
 
 
45
  QWidget *topFrame = new QWidget( this );
 
46
  setMainWidget( topFrame );
19
47
 
20
48
  QGridLayout *topLayout = new QGridLayout( topFrame );
21
49
  topLayout->setSpacing( spacingHint() );
23
51
  QLabel *label;
24
52
 
25
53
  mServerName = new QLineEdit( topFrame );
26
 
  label = new QLabel( mServerName, i18n("Name:"), topFrame );
 
54
  label = new QLabel( i18n("Name:"), topFrame );
 
55
  label->setBuddy( mServerName );
27
56
  topLayout->addWidget( label, 0, 0 );
28
57
  topLayout->addWidget( mServerName, 0, 1 );
29
58
  mServerName->setFocus();
30
59
 
31
60
  mServerUrl = new QLineEdit( topFrame );
32
 
  label = new QLabel( mServerUrl, i18n("URL:"), topFrame );
 
61
  label = new QLabel( i18n("URL:"), topFrame );
 
62
  label->setBuddy( mServerUrl );
33
63
  topLayout->addWidget( label, 1, 0 );
34
64
  topLayout->addWidget( mServerUrl, 1, 1 );
35
65
 
36
66
  mUser = new QLineEdit( topFrame );
37
 
  label = new QLabel( mUser, i18n("User:"), topFrame );
 
67
  label = new QLabel( i18n("User:"), topFrame );
 
68
  label->setBuddy( mUser );
38
69
  topLayout->addWidget( label, 2, 0 );
39
70
  topLayout->addWidget( mUser, 2, 1 );
40
71
 
41
 
  mPassword = new KPasswordEdit( topFrame );
42
 
  label = new QLabel( mPassword, i18n("Password:"), topFrame );
 
72
  mPassword = new KLineEdit( topFrame );
 
73
  mPassword->setPasswordMode(true);
 
74
  label = new QLabel( i18n("Password:"), topFrame );
 
75
  label->setBuddy( mPassword );
43
76
  topLayout->addWidget( label, 3, 0 );
44
77
  topLayout->addWidget( mPassword, 3, 1 );
45
78
 
46
79
  mVersion = new QComboBox( topFrame );
47
 
  label = new QLabel( mVersion, i18n("Bugzilla version:"), topFrame );
 
80
  label = new QLabel( i18n("Bugzilla version:"), topFrame );
 
81
  label->setBuddy( mVersion );
48
82
  topLayout->addWidget( label, 4, 0 );
49
83
  topLayout->addWidget( mVersion, 4, 1 );
50
 
  mVersion->insertStringList( BugServerConfig::bugzillaVersions() );
 
84
  mVersion->addItems( BugServerConfig::bugzillaVersions() );
51
85
}
52
86
 
53
87
void ServerConfigDialog::setServerConfig( const BugServerConfig &cfg )
60
94
  int i;
61
95
  for( i = 0; i < mVersion->count(); ++i ) {
62
96
    if ( mVersion->text( i ) == cfg.bugzillaVersion() ) {
63
 
      mVersion->setCurrentItem( i );
 
97
      mVersion->setCurrentIndex( i );
64
98
      break;
65
99
    }
66
100
  }
71
105
  BugServerConfig cfg;
72
106
 
73
107
  cfg.setName( mServerName->text() );
74
 
  cfg.setBaseUrl( KURL( mServerUrl->text() ) );
 
108
  cfg.setBaseUrl( KUrl( mServerUrl->text() ) );
75
109
  cfg.setUser( mUser->text() );
76
110
  cfg.setPassword( mPassword->text() );
77
111
  cfg.setBugzillaVersion( mVersion->currentText() );