--===============0102821168== Content-Type: multipart/signed; boundary="nextPart8778205.oCuV8Y4JFc"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit --nextPart8778205.oCuV8Y4JFc Content-Type: multipart/mixed; boundary="Boundary-01=_XAuwC6bM8+YDo3K" Content-Transfer-Encoding: 7bit Content-Disposition: inline --Boundary-01=_XAuwC6bM8+YDo3K Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On Saturday 25 June 2005 17:49, David Jarvie wrote: > Your patch doesn't appear to comply with RFC2445, which specifies that any > program arguments should be stored in the DESCRIPTION property of the > alarm. The ATTACH property, which is where the alarm->programFile() is > stored, should contain only the program name/path/URL. You need to modify > it to use Alarm::programArguments() etc. for the arguments. The attached patch does that. There is a security risk: in a shared calendar some mate can to use a=20 dangerous program. Should be gook can enable this feature only when the use= r=20 select it, other way don't inoke the procedure. Regards, =2D-=20 Keep away software patents from Europe. GPG Fingerprint: 7788 5526 6B2A 47BE 9618 8F48 30AB 1CF9 7799 71DC http://cernicalo.escomposlinux.org --Boundary-01=_XAuwC6bM8+YDo3K Content-Type: text/x-diff; charset="iso-8859-15"; name="program_alarmevent.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="program_alarmevent.diff" Index: koeditorgeneral.cpp =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =2D-- koeditorgeneral.cpp (revisi=C3=B3n: 428201) +++ koeditorgeneral.cpp (copia de trabajo) @@ -48,11 +48,13 @@ #include #include #include +#include =20 #include #include =20 #include +#include =20 #include "koprefs.h" #include "koglobals.h" @@ -260,17 +262,49 @@ void KOEditorGeneral::pickAlarmProgram() { if (!mAlarmProgramButton->isOn()) { + mAlarmProgramLast =3D mAlarmProgram; + mAlarmProgramArgsLast =3D mAlarmProgramArgs; mAlarmProgram =3D ""; + mAlarmProgramArgs =3D ""; QToolTip::remove(mAlarmProgramButton); QToolTip::add(mAlarmProgramButton, i18n("No program set")); } else { =2D QString fileName(KFileDialog::getOpenFileName(QString::null, QString= ::null, 0)); =2D if (!fileName.isEmpty()) { =2D mAlarmProgram =3D fileName; =2D QToolTip::remove(mAlarmProgramButton); =2D QString dispStr =3D i18n("Running '%1'").arg(fileName); =2D QToolTip::add(mAlarmProgramButton, dispStr); =2D mAlarmSoundButton->setOn(false); + KURL uri =3D KPimURLRequesterDlg::getURL(=20 + mAlarmProgramLast + " " + mAlarmProgramArgsLast,=20 + i18n( + "Command to be executed on reminder. You can use these macros:\n= \n" + "\t\%c - Categories\n" + "\t\%d - Description\n" + "\t\%D - Start date\n" + "\t\%e - End date\n" + "\t\%l - Location \n" + "\t\%o - Organizer\n" + "\t\%s - Summary\n" + ), mAlarmProgramButton, + i18n("Set program...") ); + if (!uri.isEmpty()) { + QString lineCmd =3D uri.pathOrURL(); + int errorArgs; + QStringList args =3D KShell::splitArgs( lineCmd,KShell::NoOptions,&e= rrorArgs ); + if ( errorArgs ) + { + KMessageBox::error( mAlarmProgramButton, + i18n( "There is an error on command line: \"Unterminated quote= d string\"" ), + i18n( "Command reminder" ) ); + pickAlarmProgram(); + } else { + mAlarmProgram =3D args[ 0 ]; + args.remove( args.first() ); + mAlarmProgramArgs =3D args.join( " " ); + + mAlarmProgramLast =3D mAlarmProgram; + mAlarmProgramArgsLast =3D mAlarmProgramArgs; + QToolTip::remove(mAlarmProgramButton); + QString dispStr =3D i18n("Running '%1 %2'").arg( mAlarmProgram ) + .arg( mAlarmProgramArgs ); + QToolTip::add(mAlarmProgramButton, dispStr); + mAlarmSoundButton->setOn(false); + } } } if (mAlarmProgram.isEmpty()) @@ -397,8 +431,10 @@ =20 if (alarm->type() =3D=3D Alarm::Procedure) { mAlarmProgram =3D alarm->programFile(); + mAlarmProgramArgs =3D alarm->programArguments(); mAlarmProgramButton->setOn(true); =2D QString dispStr =3D i18n("Running '%1'").arg(mAlarmProgram); + QString dispStr =3D i18n("Running '%1 %2' ").arg(mAlarmProgram) + .arg( mAlarmProgramArgs ); QToolTip::add(mAlarmProgramButton, dispStr); } else if (alarm->type() =3D=3D Alarm::Audio) { @@ -449,7 +485,7 @@ alarm->setDisplayAlarm(QString::null); // FIXME: Make sure all alarm options are correctly set and don't er= ase other options! if (!mAlarmProgram.isEmpty() && mAlarmProgramButton->isOn()) =2D alarm->setProcedureAlarm(mAlarmProgram); + alarm->setProcedureAlarm( mAlarmProgram, mAlarmProgramArgs ); =20 // FIXME: Deal with multiple alarms break; // For now, stop after the first alarm Index: koeditorgeneral.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =2D-- koeditorgeneral.h (revisi=C3=B3n: 428201) +++ koeditorgeneral.h (copia de trabajo) @@ -120,6 +120,10 @@ QString mCategories; QString mAlarmSound; QString mAlarmProgram; + QString mAlarmProgramArgs; + QString mAlarmProgramLast; + QString mAlarmProgramArgsLast; + }; =20 #endif Index: korgac/alarmdialog.cpp =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =2D-- korgac/alarmdialog.cpp (revisi=C3=B3n: 428201) +++ korgac/alarmdialog.cpp (copia de trabajo) @@ -38,11 +38,13 @@ #include #include #include +#include #include #include #include #include #include +#include =20 #include =20 @@ -197,14 +199,55 @@ for ( it =3D alarms.begin(); it !=3D alarms.end(); ++it ) { Alarm *alarm =3D *it; // FIXME: Check whether this should be done for all multiple alarms =2D if (alarm->type() =3D=3D Alarm::Procedure) { =2D kdDebug(5890) << "Starting program: '" << alarm->programFile() << = "'" << endl; + if (alarm->type() =3D=3D Alarm::Procedure && !alarm->programFile().isE= mpty() ) { KProcess proc; =2D proc << QFile::encodeName(alarm->programFile()); + QString expanded; + //FIXME: programFile should be a URL (RFC2445 p.72) + proc << QFile::encodeName( alarm->programFile() ); + kdDebug( 5890 ) << "Program name: " << alarm->programFile()<< endl; + kdDebug( 5890 ) << "Arguments: " << alarm->programArguments()<< endl; + // + // Arguments=20 + if (!alarm->programArguments().isEmpty() ) { + QMap subst; + subst.insert( 'c', mIncidence->categoriesStr() ); + subst.insert( 'd', mIncidence->description() ); + subst.insert( 'D', mIncidence->dtStart().toString()); + subst.insert( 'e', mIncidence->dtEnd().toString() ); + subst.insert( 'l', mIncidence->location() ); + subst.insert( 'o', mIncidence->organizer().fullName() ); + subst.insert( 's', mIncidence->summary() ); + + //If the procedure failures on reading, no procedure is invoked=20 + //(RFC2445 p.71) + expanded =3D KMacroExpander::expandMacrosShellQuote(=20 + alarm->programArguments(), subst ); + + if ( expanded.isEmpty() ) { + kdDebug( 5890 ) << "error on expanding arguments: " << expanded = << endl; + continue; //continue with the next alarms + } + + kdDebug( 5890 ) << "Arguments expanded: " << expanded << endl; + + int err; + proc << KShell::splitArgs( expanded, KShell::NoOptions, &err ); + + if ( err ) { + kdDebug( 5890 ) << "error on spliting arguments: " << expanded <= < endl; + continue; //continue with the next alarms + } + + } + + kdDebug(5890) << "Starting program: '" << alarm->programFile()=20 + << " " << expanded << "'" << endl; proc.start(KProcess::DontCare); + } else if (alarm->type() =3D=3D Alarm::Audio) { beeped =3D true; + //FIXME: audioFile should be a URL (RFC2445 p.72) KAudioPlayer::play(QFile::encodeName(alarm->audioFile())); } } --Boundary-01=_XAuwC6bM8+YDo3K-- --nextPart8778205.oCuV8Y4JFc Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) iD8DBQBCwuAbMKsc+XeZcdwRAiZsAJsE6ttwtFvyl3BF6RfdBVGePZnqIwCgh62Y TwCSdbFUkkiZS+FT0PKjEEI= =5co7 -----END PGP SIGNATURE----- --nextPart8778205.oCuV8Y4JFc-- --===============0102821168== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ kde-pim mailing list kde-pim@kde.org https://mail.kde.org/mailman/listinfo/kde-pim kde-pim home page at http://pim.kde.org/ --===============0102821168==--