[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdenetwork/kopete/plugins/otr
From:       Michael Zanetti <michael_zanetti () gmx ! net>
Date:       2009-10-09 13:29:36
Message-ID: 1255094976.056307.3491.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1033100 by mzanetti:

Make authenticationwizard behave more userfriendly and work correctly on abort()


 M  +29 -7     authenticationwizard.cpp  
 M  +2 -1      authenticationwizard.h  
 M  +5 -0      otrlchatinterface.cpp  


--- trunk/KDE/kdenetwork/kopete/plugins/otr/authenticationwizard.cpp #1033099:1033100
@@ -141,6 +141,7 @@
 	layout->addWidget(leAnswer);
 
 	page->setLayout(layout);
+	page->setCommitPage(true);
 	return page;
 }
 
@@ -160,6 +161,7 @@
 	layout->addWidget(leSecret);	
 
 	page->setLayout(layout);
+	page->setCommitPage(true);
 	return page;
 }
 
@@ -239,7 +241,7 @@
 }
 
 bool AuthenticationWizard::validateCurrentPage(){
-	kDebug() << "currentId:" << currentId();
+	kDebug(14318) << "currentId:" << currentId();
 	switch(currentId()){
 		case 1:
 			if(initiate){
@@ -268,7 +270,7 @@
 }
 
 void AuthenticationWizard::cancelVerification(){
-	kDebug() << "cancelVerification...";
+	kDebug(14318) << "cancelVerification...";
 	if(!initiate){
 		OtrlChatInterface::self()->abortSMP(context, session);
 	}
@@ -282,20 +284,20 @@
 }
 
 void AuthenticationWizard::finished(bool success, bool trust){
-	kDebug() << "****************";
+	kDebug(14318) << "authWizard finished";
 	if(currentId() == Page_Wait2){
-		kDebug() << "Yes, in wait_page2";
+		kDebug(14318) << "Yes, in wait_page2";
 		((WaitPage*)currentPage())->ready();
 		next();
 		if(success){
-			kDebug() << "auth succeeded";
+			kDebug(14318) << "auth succeeded";
 			currentPage()->setTitle(i18n("Authentication successful"));
 			if(question != NULL || rbQA->isChecked()){
 				if(initiate){
-					kDebug() << "initiate";
+					kDebug(14318) << "initiate";
 					lFinal->setText(i18n("The authentication with %1 was completed successfully. \
The conversation is now secure.", \
OtrlChatInterface::self()->formatContact(session->members().first()->contactId())));  \
                } else {
-					kDebug() << "not initiate";
+					kDebug(14318) << "not initiate";
 					if(trust){
 						lFinal->setText(i18n("The authentication with %1 was completed successfully. \
The conversation is now secure.", \
OtrlChatInterface::self()->formatContact(session->members().first()->contactId())));  \
} else { @@ -310,8 +312,27 @@
 			lFinal->setText(i18n("The authentication with %1 failed. To make sure you are not \
talking to an imposter, try again using the manual fingerprint verification method. \
Note that the conversation is now insecure.", \
OtrlChatInterface::self()->formatContact(session->members().first()->contactId())));  \
}  }
+	
+	setOption(QWizard::NoCancelButton, true);
+	
 }
 
+void AuthenticationWizard::aborted(){
+	if(currentId() == Page_SharedSecret || currentId() == Page_QuestionAnswer){
+		next();
+	}
+	if(currentId() == Page_Wait1){
+		next();
+	}
+	if(currentId() == Page_Wait2){
+		next();
+	}
+	currentPage()->setTitle(i18n("Authentication aborted"));
+	lFinal->setText(i18n("%1 has aborted the authentication process. To make sure you \
are not talking to an imposter, try again using the manual fingerprint verification \
method.", OtrlChatInterface::self()->formatContact(session->members().first()->contactId())));
 +	
+	setOption(QWizard::NoCancelButton, true);
+}
+
 void AuthenticationWizard::updateInfoBox(){
 	if(rbQA->isChecked()){
 		infoLabel->setText(i18n("Ask %1 a question, the answer to which is known only to \
you and them. If the answer does not match, you may be talking to an imposter.", \
OtrlChatInterface::self()->formatContact(session->members().first()->contactId()))); \
@@ -333,5 +354,6 @@  progressBar->setMaximum(0);
 	layout->addWidget(progressBar);
 	layout->addStretch();
+	setCommitPage(true);
 	setLayout(layout);
 }
--- trunk/KDE/kdenetwork/kopete/plugins/otr/authenticationwizard.h #1033099:1033100
@@ -50,7 +50,8 @@
 	static AuthenticationWizard *findWizard(Kopete::ChatSession *session);
 	void nextState();
 	void finished(bool success, bool trust);
-
+	void aborted();
+	
 protected:
 
 	virtual int nextId() const;
--- trunk/KDE/kdenetwork/kopete/plugins/otr/otrlchatinterface.cpp #1033099:1033100
@@ -505,10 +505,15 @@
 		}
 		tlv = otrl_tlv_find(tlvs, OTRL_TLV_SMP_ABORT);
 		if (tlv) {
+			kDebug(14318) << "other end aborted SMP";
 			Kopete::Message msg( chatSession->members().first(), \
chatSession->account()->myself() );  msg.setHtmlBody( i18n("<b>Authentication \
error.</b>") );  msg.setDirection( Kopete::Message::Internal );
 			chatSession->appendMessage( msg );
+			AuthenticationWizard *currentWizard = \
AuthenticationWizard::findWizard(chatSession); +			if(currentWizard){
+				currentWizard->aborted();
+			}
 			context->smstate->nextExpected = OTRL_SMP_EXPECT1;
 		}
 	


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic