Source Code (Use browser search to find items of interest.)
Class Index
klipper'ClipAction (./kdeutils/klipper/urlgrabber.h:93)
class ClipAction : public QObject
{
Q_OBJECT
public:
ClipAction( const QString& regExp, const QString& description );
ClipAction( const ClipAction& );
ClipAction( KConfig *kc );
~ClipAction();
void setRegExp( const QString& r) { myRegExp = r; }
QString regExp() const { return myRegExp.pattern(); }
inline bool matches( const QString& string ) const {
return ( myRegExp.match( string ) != -1 );
}
void setDescription( const QString& d) { myDescription = d; }
const QString& description() const { return myDescription; }
/**
* Removes all ClipCommands associated with this ClipAction.
*/
void clearCommands() { myCommands.clear(); }
void addCommand( const QString& command, const QString& description, bool );
const QList<ClipCommand>& commands() const { return myCommands; }
/**
* Saves this action to a a given KConfig object
*/
void save( KConfig * ) const;
private:
void startProcess( const QString& cmdLine ) const;
QRegExp myRegExp;
QString myDescription;
QList<ClipCommand> myCommands;
};
klipper'ClipAction::ClipAction() (./kdeutils/klipper/urlgrabber.cpp:276)
ClipAction::ClipAction( const QString& regExp, const QString& description )
{
myCommands.setAutoDelete( true );
myRegExp = regExp;
myDescription = description;
}
klipper'ClipAction::ClipAction() (./kdeutils/klipper/urlgrabber.cpp:284)
ClipAction::ClipAction( const ClipAction& action )
{
myCommands.setAutoDelete( true );
myRegExp = action.myRegExp;
myDescription = action.myDescription;
ClipCommand *command = 0L;
QListIterator<ClipCommand> it( myCommands );
for ( ; it.current(); ++it ) {
command = it.current();
addCommand(command->command, command->description, command->isEnabled);
}
}
klipper'ClipAction::ClipAction() (./kdeutils/klipper/urlgrabber.cpp:299)
ClipAction::ClipAction( KConfig *kc )
{
myCommands.setAutoDelete( true );
myRegExp = kc->readEntry( "Action regexp" );
myDescription = kc->readEntry( "Action description" );
int num = kc->readNumEntry( "Number of commands" );
// read the commands
QString prefix;
for ( int i = 0; i < num; i++ ) {
prefix = QString("Command_%1: ").arg( i );
addCommand( kc->readEntry( prefix + "commandline" ),
kc->readEntry( prefix + "description" ),
kc->readBoolEntry( prefix + "enabled" ) );
}
}
klipper'ClipAction::~ClipAction() (./kdeutils/klipper/urlgrabber.cpp:318)
ClipAction::~ClipAction()
{
}
klipper'ClipAction::addCommand() (./kdeutils/klipper/urlgrabber.cpp:323)
void ClipAction::addCommand( const QString& command,
const QString& description, bool enabled )
{
if ( command.isEmpty() )
return;
struct ClipCommand *cmd = new ClipCommand;
cmd->command = command;
cmd->description = description;
cmd->isEnabled = enabled;
// cmd->id = myCommands.count(); // superfluous, I think...
myCommands.append( cmd );
}
// precondition: we're in the correct action's group of the KConfig object
klipper'ClipAction::save() (./kdeutils/klipper/urlgrabber.cpp:339)
void ClipAction::save( KConfig *kc ) const
{
kc->writeEntry( "Action description", description() );
kc->writeEntry( "Action regexp", regExp() );
kc->writeEntry( "Number of commands", myCommands.count() );
QString prefix;
struct ClipCommand *cmd;
QListIterator<struct ClipCommand> it( myCommands );
// now iterate over all commands of this action
int i = 0;
while ( (cmd = it.current()) ) {
prefix = QString("Command_%1: ").arg( i );
kc->writeEntry( prefix + "commandline", cmd->command );
kc->writeEntry( prefix + "description", cmd->description );
kc->writeEntry( prefix + "enabled", cmd->isEnabled );
++i;
++it;
}
}