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

List:       kde-commits
Subject:    [kaccounts-providers] /: Only activate "Next" when the page is valid
From:       Alex Fiestas <afiestas () kde ! org>
Date:       2015-10-15 21:01:20
Message-ID: E1ZmpeK-0000yK-9X () scm ! kde ! org
[Download RAW message or body]

Git commit 8667d8c1f69fb875198aa41a6dcf49725ec68bdf by Alex Fiestas.
Committed on 17/04/2012 at 16:11.
Pushed by mklapetek into branch 'master'.

Only activate "Next" when the page is valid

M  +23   -5    basicinfo.cpp
M  +2    -0    basicinfo.h

http://commits.kde.org/kaccounts-providers/8667d8c1f69fb875198aa41a6dcf49725ec68bdf

diff --git a/basicinfo.cpp b/basicinfo.cpp
index 997b387..cd74c0a 100644
--- a/basicinfo.cpp
+++ b/basicinfo.cpp
@@ -41,6 +41,8 @@ BasicInfo::BasicInfo(OwnCloudWizard* parent)
     m_painter->setWidget(working);
 
     connect(server, SIGNAL(textChanged(QString)), this, SLOT(checkServer()));
+    connect(username, SIGNAL(textChanged(QString)), this, SIGNAL(completeChanged()));
+    connect(password, SIGNAL(textChanged(QString)), this, SIGNAL(completeChanged()));
 }
 
 BasicInfo::~BasicInfo()
@@ -50,11 +52,7 @@ BasicInfo::~BasicInfo()
 
 bool BasicInfo::validatePage()
 {
-    if (username->text().isEmpty() || password->text().isEmpty()) {
-        return false;
-    }
-
-    if (!m_validServer) {
+    if (!validData()) {
         return false;
     }
 
@@ -65,11 +63,29 @@ bool BasicInfo::validatePage()
     return true;
 }
 
+bool BasicInfo::isComplete() const
+{
+    return validData();
+}
+
 void BasicInfo::checkServer()
 {
     checkServer(server->text());
 }
 
+bool BasicInfo::validData() const
+{
+    if (username->text().isEmpty() || password->text().isEmpty()) {
+        return false;
+    }
+
+    if (!m_validServer) {
+        return false;
+    }
+
+    return true;
+}
+
 void BasicInfo::checkServer(const QString &path)
 {
     QString fixedUrl;
@@ -142,6 +158,8 @@ void BasicInfo::fileChecked(KJob* job)
     m_server = kJob->url();
     m_server.setFileName("");
     setResult(true);
+
+    Q_EMIT completeChanged();
 }
 
 void BasicInfo::setWorking(bool start)
diff --git a/basicinfo.h b/basicinfo.h
index c936866..e07e2bc 100644
--- a/basicinfo.h
+++ b/basicinfo.h
@@ -39,6 +39,7 @@ class BasicInfo : public QWizardPage, Ui_Owncloud
         virtual ~BasicInfo();
 
         virtual bool validatePage();
+        virtual bool isComplete() const;
 
     private Q_SLOTS:
         void checkServer();
@@ -46,6 +47,7 @@ class BasicInfo : public QWizardPage, Ui_Owncloud
         void dataReceived(KIO::Job *job, const QByteArray &data);
 
     private:
+        bool validData() const;
         void checkServer(const QString &path);
         void checkServer(const KUrl &url);
         void figureOutServer(const QString& urlStr);

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

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