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

List:       kde-commits
Subject:    kdebase/klipper
From:       Stephan Binner <binner () kde ! org>
Date:       2004-05-06 8:35:07
Message-ID: 20040506083507.97BF51B52 () office ! kde ! org
[Download RAW message or body]

CVS commit by binner: 

Make it possible to explicitely define an icon for actions
Btw, Klipper should check that commands are really installed...


  M +1 -0      klipperrc.desktop   1.119
  M +11 -4     urlgrabber.cpp   1.43
  M +2 -2      urlgrabber.h   1.19


--- kdebase/klipper/klipperrc.desktop  #1.118:1.119
@@ -245,4 +245,5 @@
 [Action_1/Command_1]
 Commandline=ps x |grep -q '[m]ozilla' && mozilla -remote openURL\(%s, new-window\) \
|| mozilla %s +Icon=mozilla
 Description=Open with &Mozilla
 Description[af]=Open met Mozilla

--- kdebase/klipper/urlgrabber.cpp  #1.42:1.43
@@ -372,5 +372,5 @@ void URLGrabber::slotKillPopupMenu()
 
 ClipCommand::ClipCommand(const QString &_command, const QString &_description,
-                         bool _isEnabled)
+                         bool _isEnabled, const QString &_icon)
     : command(_command),
       description(_description),
@@ -380,4 +380,9 @@ ClipCommand::ClipCommand(const QString &
     if (len == -1)
         len = command.length();
+
+    if (!_icon.isEmpty())
+        pixmap = _icon;
+    else
+    {
     KService::Ptr service= KService::serviceByDesktopName(command.left(len));
     if (service)
@@ -385,4 +390,5 @@ ClipCommand::ClipCommand(const QString &
     else
         pixmap = QString::null;
+    }
 }
 
@@ -425,5 +431,6 @@ ClipAction::ClipAction( KConfig *kc )
         addCommand( kc->readPathEntry( "Commandline" ),
                     kc->readEntry( "Description" ), // i18n'ed
-                    kc->readBoolEntry( "Enabled" ) );
+                    kc->readBoolEntry( "Enabled" ),
+                    kc->readEntry( "Icon") );
     }
 }
@@ -436,10 +443,10 @@ ClipAction::~ClipAction()
 
 void ClipAction::addCommand( const QString& command,
-                             const QString& description, bool enabled )
+                             const QString& description, bool enabled, const \
QString& icon )  {
     if ( command.isEmpty() )
         return;
 
-    struct ClipCommand *cmd = new ClipCommand( command, description, enabled );
+    struct ClipCommand *cmd = new ClipCommand( command, description, enabled, icon \
);  //    cmd->id = myCommands.count(); // superfluous, I think...
     myCommands.append( cmd );

--- kdebase/klipper/urlgrabber.h  #1.18:1.19
@@ -96,5 +96,5 @@ signals:
 struct ClipCommand
 {
-    ClipCommand( const QString &, const QString &, bool = true );
+    ClipCommand( const QString &, const QString &, bool = true, const QString & = "" \
);  QString command;
     QString description;
@@ -131,5 +131,5 @@ public:
   void clearCommands() { myCommands.clear(); }
 
-  void  addCommand( const QString& command, const QString& description, bool );
+  void  addCommand( const QString& command, const QString& description, bool, const \
QString& icon = "" );  const QPtrList<ClipCommand>& commands()       const { return \
myCommands; }  


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

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