1
/***************************************************************************
2
* Copyright (C) 2008 by Montel Laurent <montel@kde.org> *
4
* This program is free software; you can redistribute it and/or modify *
5
* it under the terms of the GNU General Public License as published by *
6
* the Free Software Foundation; either version 2 of the License, or *
7
* (at your option) any later version. *
9
* This program is distributed in the hope that it will be useful, *
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12
* GNU General Public License for more details. *
14
* You should have received a copy of the GNU General Public License *
15
* along with this program; if not, write to the *
16
* Free Software Foundation, Inc., *
17
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA *
18
***************************************************************************/
20
#include "autostartitem.h"
21
#include "autostart.h"
23
#include <QTreeWidgetItem>
24
#include <QTreeWidget>
28
#include <KIO/CopyJob>
30
AutoStartItem::AutoStartItem( const QString &service, QTreeWidgetItem *parent, Autostart* )
31
: QTreeWidgetItem( parent )
33
m_fileName = KUrl(service);
36
AutoStartItem::~AutoStartItem()
41
KUrl AutoStartItem::fileName() const
46
void AutoStartItem::setPath(const QString &path) {
47
if (path == m_fileName.directory(KUrl::AppendTrailingSlash))
49
KIO::move(m_fileName, KUrl( path + '/' + m_fileName.fileName() ));
50
m_fileName = KUrl(path + m_fileName.fileName());
54
DesktopStartItem::DesktopStartItem( const QString &service, QTreeWidgetItem *parent, Autostart*autostart )
55
: AutoStartItem( service, parent,autostart )
57
setCheckState ( Autostart::COL_STATUS,Qt::Checked );
60
DesktopStartItem::~DesktopStartItem()
64
ScriptStartItem::ScriptStartItem( const QString &service, QTreeWidgetItem *parent, Autostart* autostart )
65
: AutoStartItem( service, parent,autostart )
67
m_comboBoxStartup = new QComboBox;
68
m_comboBoxStartup->addItems( autostart->listPathName() );
70
setText( 2, i18nc( "The program will be run", "Enabled" ) );
71
QObject::connect( m_comboBoxStartup, SIGNAL(activated ( int ) ),autostart,SLOT( slotChangeStartup( int ) ) );
72
treeWidget()->setItemWidget ( this, Autostart::COL_RUN, m_comboBoxStartup );
75
ScriptStartItem::~ScriptStartItem()
79
void ScriptStartItem::changeStartup(ScriptStartItem::ENV type )
83
case ScriptStartItem::START:
84
m_comboBoxStartup->setCurrentIndex( 0 );
86
case ScriptStartItem::SHUTDOWN:
87
m_comboBoxStartup->setCurrentIndex( 1 );
89
case ScriptStartItem::PRE_START:
90
m_comboBoxStartup->setCurrentIndex( 2 );
93
kDebug()<<" type is not defined :"<<type;