1 /***************************************************************************
2 * Copyright 2007 Dukju Ahn <dukjuahn@gmail.com> *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
9 ***************************************************************************/
11 #include "svnjobbase.h"
15 #include <kpassworddialog.h>
17 #include <kmessagebox.h>
20 #include "svninternaljobbase.h"
21 #include "svnssldialog.h"
22 #include "kdevsvnplugin.h"
23 #include "svnoutputmodel.h"
25 SvnJobBase::SvnJobBase( KDevSvnPlugin
* parent
)
26 : VcsJob( parent
), m_part( parent
),
27 m_status( KDevelop::VcsJob::JobNotStarted
)
31 SvnJobBase::~SvnJobBase()
35 KDevelop::VcsJob::JobStatus
SvnJobBase::status() const
41 void SvnJobBase::askForLogin( const QString
& realm
)
43 kDebug( 9510 ) << "login";
44 KPasswordDialog
dlg( 0, KPasswordDialog::ShowUsernameLine
| KPasswordDialog::ShowKeepPassword
);
45 dlg
.setPrompt( i18n("Enter Login for: %1", realm
) );
47 internalJob()->m_login_username
= dlg
.username();
48 internalJob()->m_login_password
= dlg
.password();
49 internalJob()->m_maySave
= dlg
.keepPassword();
50 internalJob()->m_guiSemaphore
.release( 1 );
53 void SvnJobBase::showNotification( const QString
& path
, const QString
& msg
)
55 kDebug( 9510 ) << "notification" << path
<< msg
;
56 m_part
->outputModel()->appendRow( new SvnOutputItem( path
, msg
) );
59 void SvnJobBase::askForCommitMessage()
61 kDebug( 9510 ) << "commit msg";
62 internalJob()->m_guiSemaphore
.release( 1 );
65 void SvnJobBase::askForSslServerTrust( const QStringList
& failures
, const QString
& host
,
66 const QString
& print
, const QString
& from
,
67 const QString
& until
, const QString
& issuer
,
68 const QString
& realm
)
71 kDebug( 9510 ) << "servertrust";
72 SvnSSLTrustDialog dlg
;
73 dlg
.setCertInfos( host
, print
, from
, until
, issuer
, realm
, failures
);
74 if( dlg
.exec() == QDialog::Accepted
)
76 kDebug(9510) << "accepted with:" << dlg
.useTemporarily();
77 if( dlg
.useTemporarily() )
79 internalJob()->m_trustAnswer
= svn::ContextListener::ACCEPT_TEMPORARILY
;
82 internalJob()->m_trustAnswer
= svn::ContextListener::ACCEPT_PERMANENTLY
;
86 kDebug(9510) << "didn't accept";
87 internalJob()->m_trustAnswer
= svn::ContextListener::DONT_ACCEPT
;
89 internalJob()->m_guiSemaphore
.release( 1 );
92 void SvnJobBase::askForSslClientCert( const QString
& realm
)
94 KMessageBox::information( 0, realm
);
95 kDebug( 9510 ) << "clientrust";
96 internalJob()->m_guiSemaphore
.release( 1 );
99 void SvnJobBase::askForSslClientCertPassword( const QString
& )
101 kDebug( 9510 ) << "clientpw";
102 internalJob()->m_guiSemaphore
.release( 1 );
105 void SvnJobBase::internalJobStarted( ThreadWeaver::Job
* job
)
107 if( internalJob() == job
)
109 m_status
= KDevelop::VcsJob::JobRunning
;
113 void SvnJobBase::internalJobDone( ThreadWeaver::Job
* job
)
115 if( internalJob() == job
)
117 kDebug(9510) << "Job is done";
118 m_status
= KDevelop::VcsJob::JobSucceeded
;
123 void SvnJobBase::internalJobFailed( ThreadWeaver::Job
* job
)
125 if( internalJob() == job
)
128 QString msg
= internalJob()->errorMessage();
130 setErrorText( i18n( "Error executing Job:\n%1", msg
) );
131 kDebug(9510) << "Job failed";
132 m_status
= KDevelop::VcsJob::JobFailed
;
137 KDevelop::IPlugin
* SvnJobBase::vcsPlugin() const
142 #include "svnjobbase.moc"