1 /* This file is part of the KDE Project
3 Copyright (C) 2006-2008 Ralf Habacker <ralf.habacker@freenet.de>
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public
8 License version 2 as published by the Free Software Foundation.
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
25 #include <QStringList>
30 LinkFile(const QString
&_execPath
, const QString
&_linkPath
, const QString
&_description
, const QString
&_workingDir
)
32 m_execPath
= _execPath
;
33 m_arguments
= QStringList();
34 m_linkPath
= _linkPath
;
35 m_description
= _description
;
36 m_workingDir
= _workingDir
;
39 constructs LinkFile instance with arguments
41 LinkFile(const QStringList
&args
, const QString
&linkPath
, const QString
&description
, const QString
&workingDir
)
45 if (args
.size() > 1) {
47 m_arguments
.removeFirst();
49 m_linkPath
= linkPath
;
50 m_description
= description
;
51 m_workingDir
= workingDir
;
54 /// check if link file exists
56 /// create link file from instance data
60 /// read link file content into instance
63 const QString
&execPath() { return m_execPath
; }
64 const QString
&linkPath() { return m_linkPath
; }
65 const QString
&description() { return m_description
; }
66 const QString
&workingDir() { return m_workingDir
; }
67 const QStringList
&arguments() { return m_arguments
; }
69 void setExecPath(const QString
&a
) { m_execPath
= a
; }
70 void setLinkPath(const QString
&a
) { m_linkPath
= a
; }
71 void setDescription(const QString
&a
) { m_description
= a
; }
72 void setWorkingDir(const QString
&a
) { m_workingDir
= a
; }
73 void setArguments(const QStringList
&a
) { m_arguments
= a
; }
75 friend QDebug
operator<<(QDebug out
, const LinkFile
&c
);
80 QString m_description
;
82 QStringList m_arguments
;
87 static bool scan(QList
<LinkFile
> &files
, const QString
&rootDir
);
88 static bool create(QList
<LinkFile
> &newFiles
);
89 static bool cleanup(QList
<LinkFile
> &newFiles
, QList
<LinkFile
> &oldFiles
);