1
/***************************************************************************
2
smb4kwalletmanager_p - Private helper classes for the wallet manager
6
copyright : (C) 2012 by Alexander Reinholdt
7
email : alexander.reinholdt@kdemail.net
8
***************************************************************************/
10
/***************************************************************************
11
* This program is free software; you can redistribute it and/or modify *
12
* it under the terms of the GNU General Public License as published by *
13
* the Free Software Foundation; either version 2 of the License, or *
14
* (at your option) any later version. *
16
* This program is distributed in the hope that it will be useful, but *
17
* WITHOUT ANY WARRANTY; without even the implied warranty of *
18
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
19
* General Public License for more details. *
21
* You should have received a copy of the GNU General Public License *
22
* along with this program; if not, write to the *
23
* Free Software Foundation, Inc., 51 Franklin Street, Suite 500, Boston,*
24
* MA 02110-1335, USA *
25
***************************************************************************/
27
// application specific includes
28
#include "smb4kwalletmanager_p.h"
29
#include "smb4khost.h"
30
#include "smb4kshare.h"
31
#include "smb4khomesshareshandler.h"
34
#include <QtCore/QDebug>
40
Smb4KPasswordDialog::Smb4KPasswordDialog( Smb4KBasicNetworkItem* networkItem, const QMap<QString,QString> &knownLogins, QWidget* parent )
41
: KPasswordDialog( parent, KPasswordDialog::ShowUsernameLine )
45
switch ( m_item->type() )
47
case Smb4KBasicNetworkItem::Host:
49
Smb4KHost *host = static_cast<Smb4KHost *>( m_item );
53
setUsername( host->login() );
54
setPassword( host->password() );
55
setPrompt( i18n( "<qt>Please enter a username and a password for the host <b>%1</b>.</qt>", host->hostName() ) );
63
case Smb4KBasicNetworkItem::Share:
65
Smb4KShare *share = static_cast<Smb4KShare *>( m_item );
69
// Enter authentication information into the dialog
70
if ( !knownLogins.isEmpty() )
72
setKnownLogins( knownLogins );
76
setUsername( share->login() );
77
setPassword( share->password() );
80
if ( !share->isHomesShare() )
82
setPrompt( i18n( "<qt>Please enter a username and a password for the share <b>%1</b>.</qt>", share->unc() ) );
86
setPrompt( i18n( "<qt>Please enter a username and a password for the share <b>%1</b>.</qt>", share->homeUNC() ) );
101
connect( this, SIGNAL(gotUsernameAndPassword(QString,QString,bool)), SLOT(slotGotUsernameAndPassword(QString,QString,bool)) );
105
Smb4KPasswordDialog::~Smb4KPasswordDialog()
110
void Smb4KPasswordDialog::slotGotUsernameAndPassword( const QString &user, const QString &pass, bool /*keep*/ )
112
switch ( m_item->type() )
114
case Smb4KBasicNetworkItem::Host:
116
Smb4KHost *host = static_cast<Smb4KHost *>( m_item );
120
host->setLogin( user );
121
host->setPassword( pass );
129
case Smb4KBasicNetworkItem::Share:
131
Smb4KShare *share = static_cast<Smb4KShare *>( m_item );
135
share->setLogin( user );
136
share->setPassword( pass );
152
#include "smb4kwalletmanager_p.moc"