make dashboard happy
[kdenetwork.git] / krdc / maindialog.cpp
blob6b6837ed291e9f3d932f2d3925c447ab6841fc32
1 /* This file is part of the KDE project
2 Copyright (C) 2003-2004 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 "maindialog.h"
21 #include "maindialogwidget.h"
22 #include "preferencesdialog.h"
24 #include <kapplication.h>
25 #include <kguiitem.h>
26 #include <klocale.h>
27 #include <ktoolinvocation.h>
29 MainDialog::MainDialog( QWidget *parent )
30 : KDialog( parent )
32 setModal( true );
33 setCaption( i18n( "Remote Desktop Connection" ) );
34 setButtons( Ok | Close | Help | User1 );
35 setButtonGuiItem( User1, KGuiItem( i18n( "&Preferences" ), "configure" ) );
36 m_dialogWidget = new MainDialogWidget( this );
37 m_dialogWidget->setObjectName( "m_dialogWidget" );
38 setMainWidget( m_dialogWidget );
40 setButtonText( Ok, i18n( "Connect" ) );
41 enableButtonOk( false );
43 connect( m_dialogWidget, SIGNAL( hostValid( bool ) ),
44 SLOT( enableButtonOk( bool ) ) );
46 // preferences button....
47 connect( this, SIGNAL( user1Clicked() ),
48 this, SLOT( slotUser1() ) );
50 connect( this, SIGNAL( helpClicked() ),
51 this, SLOT( slotHelp() ) );
52 connect(this,SIGNAL(okClicked()),this,SLOT(slotOk()));
53 connect(this,SIGNAL(closeClicked()),this,SLOT(slotClose()));
56 void MainDialog::setRemoteHost( const QString &host )
58 m_dialogWidget->setRemoteHost( host );
61 QString MainDialog::remoteHost()
63 return m_dialogWidget->remoteHost();
66 void MainDialog::adjustWidgetSize()
68 adjustSize();
71 void MainDialog::slotHelp()
73 KToolInvocation::invokeHelp();
76 void MainDialog::slotUser1()
78 PreferencesDialog p( this );
79 p.exec();
82 void MainDialog::slotOk()
84 m_dialogWidget->save();
86 KDialog::accept();
89 void MainDialog::slotClose()
91 m_dialogWidget->save();
93 KDialog::reject();
96 #include "maindialog.moc"