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

List:       kde-commits
Subject:    extragear/multimedia/amarok/src/dialogs
From:       Peter Zhou <peterzhoulei () gmail ! com>
Date:       2009-06-05 7:39:51
Message-ID: 1244187591.805894.17146.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 977721 by peterzl:

script API version check in the script manager. We should make the GetHotStuff work \
with versioning before informing the script authors to pay attention to the \
versioning.

 M  +17 -1     ScriptManager.cpp  


--- trunk/extragear/multimedia/amarok/src/dialogs/ScriptManager.cpp #977720:977721
@@ -566,6 +566,9 @@
 {
     DEBUG_BLOCK
 
+	QStringList SupportAPIVersion;
+	SupportAPIVersion << "API V1.0.0" << "API V1.0.1";
+	QString ScriptVersion;
     if( !path.isEmpty() )
     {
         QFileInfo info( path );
@@ -578,8 +581,21 @@
             item.info = KPluginInfo( specPath );
             if ( !item.info.isValid() ) return false;
             if ( ( item.info.name() == "" ) || ( item.info.version() == "" ) || ( \
item.info.category() == "" ) ) return false; +
+            //assume it is API V1.0.0 if there is no "API V" prefix found
+            if ( !item.info.dependencies().at(0).startsWith("API V") )
+                ScriptVersion = "API V1.0.0";
+            else
+                ScriptVersion = item.info.dependencies().at(0);
+
+            if ( !SupportAPIVersion.contains( ScriptVersion ) )
+            {
+                debug() << "script API version not compatible with Amarok.";
+                return false;
+            }
+
             if ( m_scripts.contains( item.info.name() ) ) return false; //check if \
                script is already loaded...
-            debug() << "script info:" << item.info.name() << " " << \
item.info.version() << " " << item.info.category(); +            debug() << "script \
info:" << item.info.name() << " " << item.info.version() << " " << \
                item.info.category() << " " << item.info.dependencies().at(0);
             item.info.setConfig( KGlobal::config()->group( item.info.name() ) );
             item.url = url;
             item.running = false;


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

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