1 /* This file is part of the KDE project
2 Copyright (C) 2002-2003 Nadeem Hasan <nhasan@kde.org>
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; see the file COPYING. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
20 #include "preferencesdialog.h"
22 #include "hostprofiles.h"
23 #include "vnc/vncprefs.h"
24 #include "rdp/rdpprefs.h"
30 PreferencesDialog::PreferencesDialog( QWidget
*parent
)
31 : KPageDialog( parent
)
33 setFaceType( KPageDialog::Tabbed
);
34 setCaption( i18n( "Preferences" ) );
35 setButtons( Ok
| Cancel
);
36 setDefaultButton( Ok
);
37 connect( this, SIGNAL( okClicked() ), this, SLOT( slotOk() ) );
38 showButtonSeparator( true );
42 addPage( page
, i18n( "&Host Profiles" ) );
44 m_hostProfiles
= new HostProfiles( page
);
45 m_hostProfiles
->setObjectName( "m_hostProfiles" );
48 addPage( page
, i18n( "&VNC Defaults" ) );
49 m_vncPrefs
= new VncPrefs( page
);
50 m_vncPrefs
->setObjectName( "m_vncPrefs" );
52 QWidget
*spacer
= new QWidget( page
);
54 page
->setStretchFactor( spacer
, 10 );
56 m_vncPrefs
->cbShowPrefs
->setText( i18n( "Do not &show the preferences "
57 "dialog on new connections" ) );
60 addPage( page
, i18n( "RD&P Defaults" ) );
61 m_rdpPrefs
= new RdpPrefs( page
);
62 m_rdpPrefs
->setObjectName( "m_rdpPrefs" );
63 spacer
= new QWidget( page
);
64 page
->setStretchFactor( spacer
, 10 );
66 m_rdpPrefs
->cbShowPrefs
->setText( i18n( "Do not &show the preferences "
67 "dialog on new connections" ) );
69 HostPreferences
*hp
= HostPreferences::instance();
70 m_vncDefaults
= SmartPtr
<VncHostPref
>( hp
->vncDefaults() );
71 m_rdpDefaults
= SmartPtr
<RdpHostPref
>( hp
->rdpDefaults() );
76 void PreferencesDialog::load()
78 m_hostProfiles
->load();
80 m_vncPrefs
->setQuality( m_vncDefaults
->quality() );
81 m_vncPrefs
->setShowPrefs( m_vncDefaults
->askOnConnect() );
82 m_vncPrefs
->setUseKWallet( m_vncDefaults
->useKWallet() );
84 m_rdpPrefs
->setRdpWidth( m_rdpDefaults
->width() );
85 m_rdpPrefs
->setRdpHeight( m_rdpDefaults
->height() );
86 m_rdpPrefs
->setShowPrefs( m_rdpDefaults
->askOnConnect() );
87 m_rdpPrefs
->setUseKWallet( m_rdpDefaults
->useKWallet() );
88 m_rdpPrefs
->setColorDepth( m_rdpDefaults
->colorDepth() );
89 m_rdpPrefs
->setKbLayout( keymap2int( m_rdpDefaults
->layout() ));
90 m_rdpPrefs
->setResolution();
93 void PreferencesDialog::save()
95 m_hostProfiles
->save();
97 m_vncDefaults
->setQuality( m_vncPrefs
->quality() );
98 m_vncDefaults
->setAskOnConnect( m_vncPrefs
->showPrefs() );
99 m_vncDefaults
->setUseKWallet( m_vncPrefs
->useKWallet() );
101 m_rdpDefaults
->setWidth( m_rdpPrefs
->rdpWidth() );
102 m_rdpDefaults
->setHeight( m_rdpPrefs
->rdpHeight() );
103 m_rdpDefaults
->setLayout( int2keymap( m_rdpPrefs
->kbLayout() ));
104 m_rdpDefaults
->setAskOnConnect( m_rdpPrefs
->showPrefs() );
105 m_rdpDefaults
->setUseKWallet( m_rdpPrefs
->useKWallet() );
106 m_rdpDefaults
->setColorDepth( m_rdpPrefs
->colorDepth() );
108 HostPreferences
*hp
= HostPreferences::instance();
112 void PreferencesDialog::slotOk()
118 #include "preferencesdialog.moc"