[Kstars-devel] KDE/kdeedu/kstars/kstars/dialogs

Akarsh Simha akarshsimha at gmail.com
Sun Oct 25 00:23:51 CEST 2009


SVN commit 1039917 by asimha:

Replace cumbersome way of finding out which link was chosen by a more
nicer method. The QListWidget::row() method returns the list index
corresponding to a given QListWidgetItem, which makes life a lot
easier.

CCMAIL: kstars-devel at kde.org



 M  +2 -15     detaildialog.cpp  


--- trunk/KDE/kdeedu/kstars/kstars/dialogs/detaildialog.cpp #1039916:1039917
@@ -467,23 +467,10 @@
     if (m_CurrentLink == NULL) return;
 
     if ( m_CurrentLink->listWidget() == Links->InfoTitleList ) {
-        for( int j = 0; j < selectedObject->InfoTitle().count(); ++j ) {
-            if( i18nc( "Image/info menu item (should be translated)", selectedObject->InfoTitle().at(j).toLocal8Bit() ) == m_CurrentLink->text() ) {
-                URL = QString( selectedObject->InfoList().at( j ) );
-                break;
-            }
-        }
+        URL = QString( selectedObject->InfoList().at( Links->InfoTitleList->row(m_CurrentLink) ) );
     }
     else if ( m_CurrentLink->listWidget() == Links->ImageTitleList ) {
-        for( int j = 0; j < selectedObject->ImageTitle().count(); ++j ) {
-            if( i18nc( "Image/info menu item (should be translated)", selectedObject->ImageTitle().at(j).toLocal8Bit() ) == m_CurrentLink->text() ) {
-                URL = QString( selectedObject->ImageList().at( j ) );
-                break;
-            }
-        }
-
-        int i = selectedObject->ImageTitle().indexOf( m_CurrentLink->text() );
-        if (i >= 0) URL = QString( selectedObject->ImageList().at( i ) );
+        URL = QString( selectedObject->ImageList().at( Links->ImageTitleList->row(m_CurrentLink) ) );
     }
 
     if ( !URL.isEmpty() )


More information about the Kstars-devel mailing list