Bug 148287

Summary: minor QMake Manager problem
Product: [Applications] kdevelop Reporter: ferar achkar <ferarachkar>
Component: generalAssignee: Andreas Pakulat <apaku>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: 3.4.1   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description ferar achkar 2007-07-28 17:52:33 UTC
Version:           3.4.1 (using KDE KDE 3.5.7)
Installed from:    Fedora RPMs
Compiler:          4.1.2 20070626 
OS:                Linux

In a QT3 application, when adding images (icons) to the IMAGES section they end-up in the above section of DISTFILES.
Comment 1 Andreas Pakulat 2007-07-28 22:26:21 UTC
SVN commit 693726 by apaku:

Fix adding of images to qt3 projects, along the way allow qt4 projects to have IMAGES as well as qmake from qt4 handles that as well.
BUG:148287

 M  +11 -14    qmakescopeitem.cpp  
 M  +1 -1      qmakescopeitem.h  
 M  +5 -8      scope.cpp  
 M  +28 -28    trollprojectwidget.cpp  


--- branches/KDE/3.5/kdevelop/buildtools/qmake/qmakescopeitem.cpp #693725:693726
@@ -52,7 +52,7 @@
     setPixmap( 0, SmallIcon( "tar" ) );
 }
 
-GroupItem::GroupType GroupItem::groupTypeForExtension( const QString &ext, bool qt4project )
+GroupItem::GroupType GroupItem::groupTypeForExtension( const QString &ext )
 {
     if ( ext == "cpp" || ext == "cc" || ext == "c" || ext == "C" || ext == "c++" || ext == "cxx" || ext == "ocl" )
         return Sources;
@@ -60,7 +60,7 @@
         return Headers;
     else if ( ext == "ui" )
         return Forms;
-    else if ( qt4project && ( ext == "jpg" || ext == "jpeg" || ext == "png" || ext == "xpm" || ext == "gif" || ext == "bmp" ) )
+    else if ( ext == "jpg" || ext == "jpeg" || ext == "png" || ext == "xpm" || ext == "gif" || ext == "bmp" )
         return Images;
     else if ( ext == "idl" )
         return IDLs;
@@ -235,10 +235,6 @@
     {
         owner->removeValue( "FORMS", filename );
     }
-    else if ( groupType == GroupItem::Distfiles )
-    {
-        owner->removeValue( "DISTFILES", filename );
-    }
     else if ( groupType == GroupItem::Images )
     {
         owner->removeValue( "IMAGES", filename );
@@ -263,6 +259,10 @@
     {
         owner->removeValue( "IDL", filename );
     }
+    else if ( groupType == GroupItem::Distfiles )
+    {
+        owner->removeValue( "DISTFILES", filename );
+    }
     else if ( groupType == GroupItem::InstallObject )
     {
         owner->removeValue( text( 0 ) + ".files", filename );
@@ -627,15 +627,12 @@
             item->files.append( createFileItem( *it ) );
         }
     }
-    else
+    values = scope->variableValues( "IMAGES" );
+    item = createGroupItem( GroupItem::Images, "IMAGES", this );
+    groups.insert( item->groupType, item );
+    for ( it = values.begin(); it != values.end(); ++it )
     {
-        values = scope->variableValues( "IMAGES" );
-        item = createGroupItem( GroupItem::Images, "IMAGES", this );
-        groups.insert( item->groupType, item );
-        for ( it = values.begin(); it != values.end(); ++it )
-        {
-            item->files.append( createFileItem( *it ) );
-        }
+        item->files.append( createFileItem( *it ) );
     }
 
     values = scope->variableValues( "TRANSLATIONS" );
--- branches/KDE/3.5/kdevelop/buildtools/qmake/qmakescopeitem.h #693725:693726
@@ -47,7 +47,7 @@
 public:
     enum GroupType {NoType, Sources, Headers, Forms, Distfiles, Images, Resources, Lexsources, Yaccsources, Translations, IDLs, InstallRoot, InstallObject, MaxTypeEnum };
 
-    static GroupType groupTypeForExtension( const QString &ext, bool qt4project );
+    static GroupType groupTypeForExtension( const QString &ext );
     static void groupTypeMeanings( GroupItem::GroupType type, QString& title, QString& ext );
 
     GroupItem( QListView *lv, GroupType type, const QString &text, QMakeScopeItem* spitem );
--- branches/KDE/3.5/kdevelop/buildtools/qmake/scope.cpp #693725:693726
@@ -1370,15 +1370,12 @@
                 res.insert( QDir::cleanDirPath( file ) );
             }
         }
-        else
+        values = variableValues( "IMAGES" ,false );
+        for ( it = values.begin(); it != values.end(); ++it )
         {
-            values = variableValues( "IMAGES" ,false );
-            for ( it = values.begin(); it != values.end(); ++it )
-            {
-                file = myRelPath + QString(QChar(QDir::separator())) + *it;
-                file = resolveVariables( file );
-                res.insert( QDir::cleanDirPath( file ) );
-            }
+            file = myRelPath + QString(QChar(QDir::separator())) + *it;
+            file = resolveVariables( file );
+            res.insert( QDir::cleanDirPath( file ) );
         }
 
         values = variableValues( "TRANSLATIONS" ,false );
--- branches/KDE/3.5/kdevelop/buildtools/qmake/trollprojectwidget.cpp #693725:693726
@@ -77,7 +77,7 @@
 #include "scope.h"
 #include "createscopedlg.h"
 #include "disablesubprojectdlg.h"
-#include <kapplication.h> 
+#include <kapplication.h>
 
 TrollProjectWidget::TrollProjectWidget( TrollProjectPart *part )
     : QVBox( 0, "troll project widget" ), m_shownSubproject( 0 ), m_rootSubproject( 0 ),
@@ -634,20 +634,20 @@
     if ( !m_shownSubproject->scope->variableValues( "TEMPLATE" ).isEmpty() && m_shownSubproject->scope->variableValues( "TEMPLATE" ).findIndex( "app" ) == -1 )
         return ;
 
-    //only run once 
-    if (m_part->appFrontend()->isRunning()) 
-    { 
-        if (KMessageBox::questionYesNo(this, i18n("Your application is currently running. Do you want to restart it?"), i18n("Application Already Running"), i18n("&Restart Application"), i18n("Do &Nothing")) == KMessageBox::No) 
-            return; 
-        m_part->appFrontend()->stopApplication(); 
-        while(m_part->appFrontend()->isRunning()) 
-        { 
-            KApplication::kApplication()->processEvents(); 
-            usleep(100); 
-        } 
-    } 
+    //only run once
+    if (m_part->appFrontend()->isRunning())
+    {
+        if (KMessageBox::questionYesNo(this, i18n("Your application is currently running. Do you want to restart it?"), i18n("Application Already Running"), i18n("&Restart Application"), i18n("Do &Nothing")) == KMessageBox::No)
+            return;
+        m_part->appFrontend()->stopApplication();
+        while(m_part->appFrontend()->isRunning())
+        {
+            KApplication::kApplication()->processEvents();
+            usleep(100);
+        }
+    }
 
- 
+
     QString program = KProcess::quote( "." + QString( QChar( QDir::separator() ) ) + getCurrentOutputFilename() );
 
     // Build environment variables to prepend to the executable path
@@ -1180,7 +1180,7 @@
             addSubprojectToItem( findSubprojectForPath( QFileInfo( fileName ).dirPath() ), QFileInfo( fileName ).fileName() );
         }else
         {
-            addFileToCurrentSubProject( GroupItem::groupTypeForExtension( ext, m_part->isQt4Project() ), noPathFileName );
+            addFileToCurrentSubProject( GroupItem::groupTypeForExtension( ext ), noPathFileName );
             slotOverviewSelectionChanged( m_shownSubproject );
             kdDebug(9024) << "emitting" << relativeToProjectRoot << " " << fileName << endl;
             if( relativeToProjectRoot )
@@ -2012,19 +2012,19 @@
         return ;
     }
 
-    //only run once 
-    if (m_part->appFrontend()->isRunning()) 
-    { 
-        if (KMessageBox::questionYesNo(this, i18n("Your application is currently running. Do you want to restart it?"), i18n("Application Already Running"), i18n("&Restart Application"), i18n("Do &Nothing")) == KMessageBox::No) 
-            return; 
-        m_part->appFrontend()->stopApplication(); 
-        while(m_part->appFrontend()->isRunning()) 
-        { 
-            KApplication::kApplication()->processEvents(); 
-            usleep(100); 
-        } 
-    } 
- 
+    //only run once
+    if (m_part->appFrontend()->isRunning())
+    {
+        if (KMessageBox::questionYesNo(this, i18n("Your application is currently running. Do you want to restart it?"), i18n("Application Already Running"), i18n("&Restart Application"), i18n("Do &Nothing")) == KMessageBox::No)
+            return;
+        m_part->appFrontend()->stopApplication();
+        while(m_part->appFrontend()->isRunning())
+        {
+            KApplication::kApplication()->processEvents();
+            usleep(100);
+        }
+    }
+
     if ( !program.startsWith( QDir::rootDirPath() ) )
         program.prepend( "." + QString( QChar( QDir::separator() ) ) );