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

List:       kde-commits
Subject:    KDE/kdegraphics/okular/ui
From:       Pino Toscano <pino () kde ! org>
Date:       2010-08-08 17:06:42
Message-ID: 20100808170642.8A914AC73B () svn ! kde ! org
[Download RAW message or body]

SVN commit 1160649 by pino:

ask for the annotation author before creating the actual annotator, so we can avoid it if needed
also, no need to iterate again, as the input dialog will not accept an empty (not totally blank) value
furthermore, abort annotator creation if the user aborts the input dialog
BUG: 236865


 M  +28 -0     pageview.cpp  
 M  +0 -20     pageviewannotator.cpp  


--- trunk/KDE/kdegraphics/okular/ui/pageview.cpp #1160648:1160649
@@ -39,6 +39,7 @@
 #include <kfiledialog.h>
 #include <kglobal.h>
 #include <kglobalsettings.h>
+#include <kinputdialog.h>
 #include <kselectaction.h>
 #include <ktoggleaction.h>
 #include <kdebug.h>
@@ -3415,6 +3416,33 @@
     if ( on && d->mouseMode != MouseNormal )
         d->aMouseNormal->trigger();
 
+    // ask for Author's name if not already set
+    if ( Okular::Settings::identityAuthor().isEmpty() )
+    {
+        // get default username from the kdelibs/kdecore/KUser
+        KUser currentUser;
+        QString userName = currentUser.property( KUser::FullName ).toString();
+        // ask the user for confirmation/change
+        if ( userName.isEmpty() )
+        {
+            bool ok = false;
+            userName = KInputDialog::getText(
+                           i18n( "Annotations author" ),
+                           i18n( "Please insert your name or initials:" ),
+                           QString(),
+                           &ok );
+            if ( !ok )
+            {
+                d->aToggleAnnotator->trigger();
+                inHere = false;
+                return;
+            }
+        }
+        // save the name
+        Okular::Settings::setIdentityAuthor( userName );
+        Okular::Settings::self()->writeConfig();
+    }
+
     // create the annotator object if not present
     if ( !d->annotator )
     {
--- trunk/KDE/kdegraphics/okular/ui/pageviewannotator.cpp #1160648:1160649
@@ -686,27 +686,7 @@
 
     // show the toolBar
     m_toolBar->showAndAnimate();
-
-    // ask for Author's name if not already set
-    if ( Okular::Settings::identityAuthor().isEmpty() )
-    {
-        // get default username from the kdelibs/kdecore/KUser
-        KUser currentUser;
-        QString userName = currentUser.property( KUser::FullName ).toString();
-        // ask the user for confirmation/change
-        bool firstTry = true;
-        while ( firstTry || userName.isEmpty()  )
-        {
-            QString prompt = firstTry ? i18n( "Please insert your name or initials:" ) :
-                i18n( "You must set this name:" );
-            userName = KInputDialog::getText( i18n("Annotations author"), prompt, userName );
-            firstTry = false;
         }
-        // save the name
-        Okular::Settings::setIdentityAuthor( userName );
-        Okular::Settings::self()->writeConfig();
-    }
-}
 
 void PageViewAnnotator::setTextToolsEnabled( bool enabled )
 {
[prev in list] [next in list] [prev in thread] [next in thread] 

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