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
|
/* This file is part of the KDE project
Copyright (C) 2002-2003 Nadeem Hasan <[email protected]>
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; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "preferencesdialog.h"
#include "hostprofiles.h"
#include "vnc/vncprefs.h"
#include "rdp/rdpprefs.h"
#include "rdp/krdpview.h"
#include "vnc/kvncview.h"
#include <tqcheckbox.h>
#include <tqvbox.h>
#include <klistview.h>
#include <klocale.h>
PreferencesDialog::PreferencesDialog( TQWidget *parent, const char *name )
: KDialogBase( Tabbed, i18n( "Preferences" ), Ok|Cancel, Ok,
parent, name, true )
{
TQVBox *page;
TQWidget *spacer;
page = addVBoxPage( i18n( "&Host Profiles" ) );
m_hostProfiles = new HostProfiles( page, "m_hostProfiles" );
connect( m_hostProfiles, TQT_SIGNAL( hostDoubleClicked(HostPrefPtr) ), this, TQT_SLOT( slotHostDoubleClicked(HostPrefPtr) ));
page = addVBoxPage( i18n( "&VNC Defaults" ) );
m_vncPrefs = new VncPrefs( page, "m_vncPrefs" );
spacer = new TQWidget( page );
page->setStretchFactor( spacer, 10 );
m_vncPrefs->cbShowPrefs->setText( i18n( "Do not &show the preferences "
"dialog on new connections" ) );
page = addVBoxPage( i18n( "RD&P Defaults" ) );
m_rdpPrefs = new RdpPrefs( page, "m_rdpPrefs" );
spacer = new TQWidget( page );
page->setStretchFactor( spacer, 10 );
m_rdpPrefs->cbShowPrefs->setText( i18n( "Do not &show the preferences "
"dialog on new connections" ) );
HostPreferences *hp = HostPreferences::instance();
m_vncDefaults = SmartPtr<VncHostPref>( hp->vncDefaults() );
m_rdpDefaults = SmartPtr<RdpHostPref>( hp->rdpDefaults() );
load();
}
void PreferencesDialog::load()
{
m_hostProfiles->load();
m_vncPrefs->setQuality( m_vncDefaults->quality() );
m_vncPrefs->setShowPrefs( m_vncDefaults->askOnConnect() );
m_vncPrefs->setUseKWallet( m_vncDefaults->useKWallet() );
m_rdpPrefs->setRdpWidth( m_rdpDefaults->width() );
m_rdpPrefs->setRdpHeight( m_rdpDefaults->height() );
m_rdpPrefs->setShowPrefs( m_rdpDefaults->askOnConnect() );
m_rdpPrefs->setUseKWallet( m_rdpDefaults->useKWallet() );
m_rdpPrefs->setColorDepth( m_rdpDefaults->colorDepth() );
m_rdpPrefs->setKbLayout( keymap2int( m_rdpDefaults->layout() ));
m_rdpPrefs->setResolution();
}
void PreferencesDialog::save()
{
m_hostProfiles->save();
m_vncDefaults->setQuality( m_vncPrefs->quality() );
m_vncDefaults->setAskOnConnect( m_vncPrefs->showPrefs() );
m_vncDefaults->setUseKWallet( m_vncPrefs->useKWallet() );
m_rdpDefaults->setWidth( m_rdpPrefs->rdpWidth() );
m_rdpDefaults->setHeight( m_rdpPrefs->rdpHeight() );
m_rdpDefaults->setLayout( int2keymap( m_rdpPrefs->kbLayout() ));
m_rdpDefaults->setAskOnConnect( m_rdpPrefs->showPrefs() );
m_rdpDefaults->setUseKWallet( m_rdpPrefs->useKWallet() );
m_rdpDefaults->setColorDepth( m_rdpPrefs->colorDepth() );
HostPreferences *hp = HostPreferences::instance();
hp->sync();
}
void PreferencesDialog::slotOk()
{
save();
accept();
}
void PreferencesDialog::slotHostDoubleClicked( HostPrefPtr hp )
{
bool hostChanged = false;
if( hp->type() == RdpHostPref::RdpType )
hostChanged = KRdpView::editPreferences( hp );
else if( hp->type() == VncHostPref::VncType )
hostChanged = KVncView::editPreferences( hp );
if( hostChanged )
{
m_hostProfiles->hostListView->clear();
m_hostProfiles->load();
}
}
#include "preferencesdialog.moc"
|