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

List:       kde-commits
Subject:    branches/KDE/3.5/kdesdk/kbabel
From:       Nicolas Goutte <nicolasg () snafu ! de>
Date:       2006-02-07 22:40:57
Message-ID: 1139352057.785263.20995.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 506940 by goutte:

Use the list versions of the message boxes to show the error text of msgfmt
(Otherwise the dialog box might get very tall.)
(Unfortunately KMessageBox::errorList is only since KDE 3.4.)


 M  +7 -6      common/catalog.cpp  
 M  +21 -15    kbabel/kbabelview.cpp  


--- branches/KDE/3.5/kdesdk/kbabel/common/catalog.cpp #506939:506940
@@ -1108,15 +1108,16 @@
       if( !d->_header.msgstr().isEmpty() )
          currentLine=d->_header.totalLines()+1;
 
-      QStringList lines = QStringList::split("\n",output);
-      for ( QStringList::Iterator it = lines.begin(); it != lines.end(); ++it )
+      // ### KDE4: return "lines" not "output"
+      const QStringList lines = QStringList::split("\n",output);
+      for ( QStringList::const_iterator it = lines.constBegin(); it != lines.constEnd(); ++it )
       {
-         if( (*it).contains(QRegExp("^.+:\\d+:")) )
+         if( (*it).find(QRegExp("^.+:\\d+:")) >= 0 )
          {
-            int begin=(*it).find(":",0)+1;
-            int end=(*it).find(":",begin);
+            const int begin=(*it).find(":",0)+1;
+            const int end=(*it).find(":",begin);
 
-            QString line=(*it).mid(begin,end-begin);
+            const QString line=(*it).mid(begin,end-begin);
 
             while( line.toInt() > currentLine )
             {
--- branches/KDE/3.5/kdesdk/kbabel/kbabel/kbabelview.cpp #506939:506940
@@ -1611,15 +1611,16 @@
 
    Msgfmt::Status result=_catalog->checkSyntax( output );
 
+   const QStringList outputLines = QStringList::split("\n",output);
+   
    switch(result)
    {
       case Msgfmt::Ok:
       {
           if(!msgOnlyAtError)
           {
-                KMessageBox::information(this
-                          ,i18n("The file is syntactically correct.\n\n\
-Output of \"msgfmt --statistics\":\n")+output);
+              KMessageBox::informationList( this, i18n("The file is syntactically correct.\n\n"
+                  "Output of \"msgfmt --statistics\":\n"), outputLines );
           }
           returnCode=true;
           break;
@@ -1640,13 +1641,12 @@
           QString msg= result==Msgfmt::SyntaxError ? i18n("msgfmt detected a syntax error.\n\n\
 Output of \"msgfmt --statistics\":\n") : i18n("msgfmt detected a header syntax error.\n\n\
 Output of \"msgfmt --statistics\":\n");
-	  msg = msg+output;
 
           if(question)
           {
-              switch( KMessageBox::warningContinueCancel(this,
-                    msg+i18n("\nDo you want to continue or cancel and edit the file again?")
-                    ,i18n("Warning"),KStdGuiItem::cont()) )
+              switch( KMessageBox::warningContinueCancelList( this,
+                    msg+i18n("\nDo you want to continue or cancel and edit the file again?"),
+                    outputLines, i18n("Warning"), KStdGuiItem::cont()) )
               {
                     case KMessageBox::Continue:
                         returnCode=true;
@@ -1657,8 +1657,11 @@
           }
           else
           {
-              KMessageBox::error(this
-                      ,msg+i18n("\nPlease edit the file again."));
+#if KDE_IS_VERSION ( 3, 4, 0 )
+              KMessageBox::errorList( this, msg+i18n("\nPlease edit the file again."), outputLines );
+#else
+              KMessageBox::error( this, msg+output+i18n("\nPlease edit the file again.") );
+#endif
               returnCode=false;
           }
           break;
@@ -1671,9 +1674,9 @@
 the GNU gettext package properly.");
             if(question)
             {
-                switch( KMessageBox::warningContinueCancel(this,
-		msg+i18n("\nDo you want to continue or cancel and edit the file again?")
-		,i18n("Warning"),KStdGuiItem::cont() ))
+                switch( KMessageBox::warningContinueCancelList( this,
+		msg+i18n("\nDo you want to continue or cancel and edit the file again?"),
+                outputLines, i18n("Warning"), KStdGuiItem::cont() ))
                 {
                     case KMessageBox::Continue:
                         returnCode=true;
@@ -1684,9 +1687,12 @@
             }
             else
             {
-                KMessageBox::error(this
-                        ,msg+i18n("\nPlease edit the file again."));
-                returnCode=false;
+#if KDE_IS_VERSION ( 3, 4, 0 )
+                 KMessageBox::errorList( this, msg+i18n("\nPlease edit the file again."), outputLines );
+#else
+                 KMessageBox::error( this, msg+output+i18n("\nPlease edit the file again.") );
+#endif
+                 returnCode=false;
             }
 
             break;
[prev in list] [next in list] [prev in thread] [next in thread] 

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