add more spacing
[personal-kdebase.git] / runtime / platforms / win / kwinstartmenu / linkfile.h
blobcbc0906cb32b0abb48242977aac7dbbd8228e5d1
1 /* This file is part of the KDE Project
3 Copyright (C) 2006-2008 Ralf Habacker <ralf.habacker@freenet.de>
4 All rights reserved.
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.
20 #ifndef _LINKFILE_H
21 #define _LINKFILE_H
23 #include <QList>
24 #include <QString>
25 #include <QStringList>
27 class LinkFile {
28 public:
29 /// create instance
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;
38 /**
39 constructs LinkFile instance with arguments
41 LinkFile(const QStringList &args, const QString &linkPath, const QString &description, const QString &workingDir)
43 if (args.size() > 0)
44 m_execPath = args[0];
45 if (args.size() > 1) {
46 m_arguments = args;
47 m_arguments.removeFirst();
49 m_linkPath = linkPath;
50 m_description = description;
51 m_workingDir = workingDir;
54 /// check if link file exists
55 bool exists();
56 /// create link file from instance data
57 bool create();
58 /// remove link file
59 bool remove();
60 /// read link file content into instance
61 bool read();
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);
77 protected:
78 QString m_execPath;
79 QString m_linkPath;
80 QString m_description;
81 QString m_workingDir;
82 QStringList m_arguments;
85 class LinkFiles {
86 public:
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);
92 #endif
93 // vim: ts=4 sw=4 et