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

Jason Harris kstars at 30doradus.org
Sun Jul 3 03:26:35 CEST 2005


SVN commit 431032 by harris:

applying patch from Mike Diehl, which makes it possible to run KStars 
DCOP scripts, even when they do not look like a script built with the 
Script Builder tool.  The user gets a scary warning message before 
executing one of these scripts.

This allows for much more elaborate scripts than the Script Builder GUI 
can provide.

I added a "don't ask again" option to the warning message box.

Congratulations, Mike: you are now a KStars developer!  Wear your 
uniform with pride. :)

CCMAIL: kstars-devel at kde.org



 M  +12 -9     kstarsactions.cpp  


--- trunk/KDE/kdeedu/kstars/kstars/kstarsactions.cpp #431031:431032
@@ -533,16 +533,19 @@
 		}
 
 		if ( ! fileOK ) {
-			KMessageBox::sorry( 0, i18n( "The selected file appears to be an invalid KStars script." ),
-					i18n( "Script Validation Failed" ) );
-		} else {
-			//file is OK, run it!
-			KProcess p;
-			p << f.name();
-			p.start( KProcess::DontCare );
+			int answer;
+			answer = KMessageBox::warningYesNo( 0, i18n( "The selected script contains unrecognized elements,"
+				"indicating that it was not created using the KStars script builder. "
+				"This script may not function properly, and it may even contain malicious code. "
+				"Would you like to execute it anyway?" ),
+					i18n( "Script Validation Failed" ), KStdGuiItem::yes(), KStdGuiItem::no(), "daExecuteScript" );
+			if ( answer == KMessageBox::No ) return;
+		}
+		KProcess p;
+		p << f.name();
+		p.start( KProcess::DontCare );
 
-			while ( p.isRunning() ) kapp->processEvents( 50 ); //otherwise tempfile may get deleted before script completes.
-		}
+		while ( p.isRunning() ) kapp->processEvents( 50 ); //otherwise tempfile may get deleted before script completes.
 	}
 }
 


More information about the Kstars-devel mailing list