<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.kde.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugs.kde.org/"
          
          maintainer="sysadmin@kde.org"
>

    <bug>
          <bug_id>228795</bug_id>
          
          <creation_ts>2010-02-27 19:21:12 +0000</creation_ts>
          <short_desc>script added to autostart cannot be configured to run at shutdown</short_desc>
          <delta_ts>2012-11-25 07:50:40 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>2</classification_id>
          <classification>Applications</classification>
          <product>systemsettings</product>
          <component>kcm_autostart</component>
          <version>unspecified</version>
          <rep_platform>Gentoo Packages</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>investigated</keywords>
          <priority>NOR</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Peter Gantner">nephros</reporter>
          <assigned_to name="Laurent Montel">montel</assigned_to>
          <cc>brunomcl</cc>
    
    <cc>kde</cc>
    
    <cc>michael</cc>
    
    <cc>mikiya.okuno</cc>
    
    <cc>s_chriscollins</cc>
          
          <cf_commitlink>http://commits.kde.org/kde-workspace/044c91d6f6adf3e3d935c652c659f5346c6c2011</cf_commitlink>
          <cf_versionfixedin>4.9.4</cf_versionfixedin>
          <cf_sentryurl></cf_sentryurl>
          <votes>0</votes>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>925680</commentid>
    <comment_count>0</comment_count>
    <who name="Peter Gantner">nephros</who>
    <bug_when>2010-02-27 19:21:12 +0000</bug_when>
    <thetext>Version:           1.0 (using KDE 4.4.0)
Compiler:          gcc (Gentoo 4.3.4 p1.0, pie-10.1.5) 4.3.4  
OS:                Linux
Installed from:    Gentoo Packages

 - open systemsettings
 - go to Advanced
 - go to Autostart
 - click &quot;add script&quot;
 - select a script, leave &quot;create as symlink&quot; checked
 - click OK
 --&gt; script is aded to the &quot;Scripts listing&quot;

 - in the scripts listing in the &quot;Run On&quot; column, select &quot;shutdown&quot;
 - Click &quot;Overview&quot; button to exit Autostart settings
 - re-enter &quot;Autostart&quot; settings
--&gt; script is still in the listing, but set to run on startup.

Effects in ~/.kde4/:
 - symlink to the script file is correctly created in ~/.kde4/Autostart
 - if it does not exist, ~/.kde4/shutdown directory is created
 - *but* symlink is never moved to the ~/.kde4/shutdown directory</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>925681</commentid>
    <comment_count>1</comment_count>
    <who name="Peter Gantner">nephros</who>
    <bug_when>2010-02-27 19:22:29 +0000</bug_when>
    <thetext>for got one thing:

If I later move the symlink from ~/.kde4/Autostart to ~/.kde4/shutdown, the Autostart settings shows it correctly configured to run on shutdown.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1129765</commentid>
    <comment_count>2</comment_count>
    <who name="">brunomcl</who>
    <bug_when>2011-06-11 05:40:39 +0000</bug_when>
    <thetext>I&apos;d like to confirm this bug in KDE 4.6.3 &quot;release 4&quot;, exactly as the OP described.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1138275</commentid>
    <comment_count>3</comment_count>
    <who name="S. Christian Collins">s_chriscollins</who>
    <bug_when>2011-07-04 19:01:49 +0000</bug_when>
    <thetext>I can confirm this bug exists in KDE 4.6.4 as well.  Additionally, setting a script to run on shutdown will often move the wrong script to the shutdown folder!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1138283</commentid>
    <comment_count>4</comment_count>
    <who name="S. Christian Collins">s_chriscollins</who>
    <bug_when>2011-07-04 19:30:49 +0000</bug_when>
    <thetext>I figured out what is happening:
1) When a script is set to &quot;Startup&quot;, it is to be placed in ~/.kde/Autostart.  When a script is set to &quot;Shutdown&quot;, it is to be placed in ~/.kde/shutdown.
2) When you select one of these options, the KDE autostart module is moving the script that is currently highlighted (blue by default) regardless of which script&apos;s combo box you have just accessed.

So, the current workaround is to click on the script&apos;s entry so it is highlighted in blue, then select its startup option from the combo box.

BTW: I didn&apos;t test with the &quot;Pre-KDE Startup&quot; option, but I&apos;d assume it&apos;s the same story there.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1310085</commentid>
    <comment_count>5</comment_count>
    <who name="Mikiya Okuno">mikiya.okuno</who>
    <bug_when>2012-10-27 23:31:08 +0000</bug_when>
    <thetext>I face the same problem too.

I figure out the problem. This happens when there are more than one items under the &quot;Script File&quot;. Every time when manipulate an item which does not has the focus, the focused item is moved! So item selection is wrong.

void Autostart::slotChangeStartup( int index )
{
    if ( widget-&gt;listCMD-&gt;currentItem() == 0 )
        return;
    ScriptStartItem* entry = dynamic_cast&lt;ScriptStartItem*&gt;( widget-&gt;listCMD-&gt;currentItem() );
    if ( entry )
    {
        entry-&gt;setPath(m_paths.value(index));
        if ( ( index != 0 ) &amp;&amp; !entry-&gt;fileName().path().endsWith( &quot;.sh&quot; ))
            KMessageBox::information( this, i18n( &quot;Only files with “.sh” extensions are allowed for setting up the environment.&quot; ) );
    }
}

QListWidget::currentItem() does not return the item which is manipulated, but returns the item which has the focus. I don&apos;t know what is the correct logic to select the item though.

Cheers!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1314109</commentid>
    <comment_count>6</comment_count>
    <who name="Jekyll Wu">adaptee</who>
    <bug_when>2012-11-10 05:42:17 +0000</bug_when>
    <thetext>Thanks for the helpful steps and investigation. I will see whether I can do something to fix this :)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1314110</commentid>
    <comment_count>7</comment_count>
    <who name="Jekyll Wu">adaptee</who>
    <bug_when>2012-11-10 06:01:15 +0000</bug_when>
    <thetext>Git commit 044c91d6f6adf3e3d935c652c659f5346c6c2011 by Jekyll Wu.
Committed on 10/11/2012 at 05:40.
Pushed by jekyllwu into branch &apos;KDE/4.9&apos;.

Make sure the right item is operated on when changing startup type

The problem was the &quot;current&quot; item was sometime not the one you would
have expected when changing the startup type of item A:

  * it could be &quot;none&quot;
  * it could be the previous &quot;current&quot; item

The fix is a little hacky, but better than none.
FIXED-IN: 4.9.4

M  +8    -7    kcontrol/autostart/autostart.cpp
M  +1    -1    kcontrol/autostart/autostart.h
M  +8    -1    kcontrol/autostart/autostartitem.cpp
M  +11   -1    kcontrol/autostart/autostartitem.h

http://commits.kde.org/kde-workspace/044c91d6f6adf3e3d935c652c659f5346c6c2011</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1314113</commentid>
    <comment_count>8</comment_count>
    <who name="Jekyll Wu">adaptee</who>
    <bug_when>2012-11-10 06:11:09 +0000</bug_when>
    <thetext>*** Bug 171139 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1314114</commentid>
    <comment_count>9</comment_count>
    <who name="S. Christian Collins">s_chriscollins</who>
    <bug_when>2012-11-10 06:17:22 +0000</bug_when>
    <thetext>Thanks for the fix, Jekyll!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1314127</commentid>
    <comment_count>10</comment_count>
    <who name="Mikiya Okuno">mikiya.okuno</who>
    <bug_when>2012-11-10 08:32:34 +0000</bug_when>
    <thetext>Jekyll,

Thank you for the fix! The fix looks reasonable.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1318234</commentid>
    <comment_count>11</comment_count>
    <who name="Jekyll Wu">adaptee</who>
    <bug_when>2012-11-25 07:50:40 +0000</bug_when>
    <thetext>*** Bug 310629 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>