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

List:       kde-commits
Subject:    kdebase/kicker/buttons
From:       Waldo Bastian <bastian () kde ! org>
Date:       2004-08-07 10:59:03
Message-ID: 20040807105903.955019A59 () office ! kde ! org
[Download RAW message or body]

CVS commit by waba: 

* Don't crash when the service has become unavailable for some reason
* Don't copy the file in saveAs, only update the URL.


  M +6 -4      servicebutton.cpp   1.22


--- kdebase/kicker/buttons/servicebutton.cpp  #1.21:1.22
@@ -137,5 +137,5 @@ void ServiceButton::saveConfig( KConfigG
 {
     config.writePathEntry("StorageId", _id );
-    if (!config.hasKey("DesktopFile"))
+    if (!config.hasKey("DesktopFile") && _service)
        config.writePathEntry("DesktopFile", _service->desktopEntryPath());
 }
@@ -153,5 +153,5 @@ void ServiceButton::dropEvent( QDropEven
 {
     KURL::List uriList;
-    if( KURLDrag::decode( ev, uriList ) ) {
+    if( KURLDrag::decode( ev, uriList ) && _service ) {
         kapp->propagateSessionManager();
         KRun::run( *_service, uriList );
@@ -179,5 +179,5 @@ void ServiceButton::mouseReleaseEvent(QM
 void ServiceButton::mouseMoveEvent(QMouseEvent *e)
 {
-    if (!is_lmb_down || (e->state() & LeftButton) == 0) return;
+    if (!is_lmb_down || !_service || (e->state() & LeftButton) == 0) return;
 
     QPoint p(e->pos() - last_lmb_press);
@@ -204,4 +204,5 @@ void ServiceButton::mouseMoveEvent(QMous
 void ServiceButton::slotExec()
 {
+    if (!_service) return;
     KIconEffect::visualActivate(this, rect());
 
@@ -213,4 +214,5 @@ void ServiceButton::slotExec()
 void ServiceButton::properties()
 {
+    if (!_service) return;
     QString path = _service->desktopEntryPath();
 
@@ -238,5 +240,5 @@ void ServiceButton::slotSaveAs(const KUR
     if (locateLocal("appdata", oldUrl.fileName()) != oldPath)
     {
-       QString path = copyDesktopFile(oldUrl);
+       QString path = newDesktopFile(oldUrl);
        newUrl.setPath(path);
        _id = path;


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

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