KNewStuff
installation.cpp
Go to the documentation of this file.00001 /* 00002 This file is part of KNewStuff2. 00003 Copyright (c) 2007 Josef Spillner <spillner@kde.org> 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Lesser General Public 00007 License as published by the Free Software Foundation; either 00008 version 2.1 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Lesser General Public License for more details. 00014 00015 You should have received a copy of the GNU Lesser General Public 00016 License along with this library. If not, see <http://www.gnu.org/licenses/>. 00017 */ 00018 00019 #include "installation.h" 00020 00021 struct KNS::InstallationPrivate { 00022 InstallationPrivate() { 00023 m_checksumpolicy = Installation::CheckIfPossible; 00024 m_signaturepolicy = Installation::CheckIfPossible; 00025 m_scope = Installation::ScopeUser; 00026 m_customname = false; 00027 } 00028 00029 QString m_command; 00030 QString m_uninstallCommand; 00031 QString m_uncompression; 00032 QString m_standardresourcedir; 00033 QString m_targetdir; 00034 QString m_installpath; 00035 QString m_absoluteinstallpath; 00036 Installation::Policy m_checksumpolicy; 00037 Installation::Policy m_signaturepolicy; 00038 Installation::Scope m_scope; 00039 bool m_customname; 00040 }; 00041 00042 using namespace KNS; 00043 00044 Installation::Installation() 00045 : d(new InstallationPrivate) 00046 { 00047 } 00048 00049 Installation::~Installation() 00050 { 00051 delete d; 00052 } 00053 00054 void Installation::setUncompression(const QString& uncompression) 00055 { 00056 d->m_uncompression = uncompression; 00057 } 00058 00059 void Installation::setCommand(const QString& command) 00060 { 00061 d->m_command = command; 00062 } 00063 00064 void Installation::setUninstallCommand(const QString& command) 00065 { 00066 d->m_uninstallCommand = command; 00067 } 00068 00069 void Installation::setStandardResourceDir(const QString& dir) 00070 { 00071 d->m_standardresourcedir = dir; 00072 } 00073 00074 void Installation::setTargetDir(const QString& dir) 00075 { 00076 d->m_targetdir = dir; 00077 } 00078 00079 void Installation::setInstallPath(const QString& dir) 00080 { 00081 d->m_installpath = dir; 00082 } 00083 00084 void Installation::setAbsoluteInstallPath(const QString& dir) 00085 { 00086 d->m_absoluteinstallpath = dir; 00087 } 00088 00089 void Installation::setChecksumPolicy(Policy policy) 00090 { 00091 d->m_checksumpolicy = policy; 00092 } 00093 00094 void Installation::setSignaturePolicy(Policy policy) 00095 { 00096 d->m_signaturepolicy = policy; 00097 } 00098 00099 void Installation::setScope(Scope scope) 00100 { 00101 d->m_scope = scope; 00102 } 00103 00104 void Installation::setCustomName(bool customname) 00105 { 00106 d->m_customname = customname; 00107 } 00108 00109 QString Installation::uncompression() const 00110 { 00111 return d->m_uncompression; 00112 } 00113 00114 QString Installation::command() const 00115 { 00116 return d->m_command; 00117 } 00118 00119 QString Installation::uninstallCommand() const 00120 { 00121 return d->m_uninstallCommand; 00122 } 00123 00124 QString Installation::standardResourceDir() const 00125 { 00126 return d->m_standardresourcedir; 00127 } 00128 00129 QString Installation::targetDir() const 00130 { 00131 return d->m_targetdir; 00132 } 00133 00134 QString Installation::installPath() const 00135 { 00136 return d->m_installpath; 00137 } 00138 00139 QString Installation::absoluteInstallPath() const 00140 { 00141 return d->m_absoluteinstallpath; 00142 } 00143 00144 bool Installation::isRemote() const 00145 { 00146 if (!installPath().isEmpty()) return false; 00147 if (!targetDir().isEmpty()) return false; 00148 if (!absoluteInstallPath().isEmpty()) return false; 00149 if (!standardResourceDir().isEmpty()) return false; 00150 return true; 00151 } 00152 00153 Installation::Policy Installation::checksumPolicy() const 00154 { 00155 return d->m_checksumpolicy; 00156 } 00157 00158 Installation::Policy Installation::signaturePolicy() const 00159 { 00160 return d->m_signaturepolicy; 00161 } 00162 00163 bool Installation::customName() const 00164 { 00165 return d->m_customname; 00166 } 00167 00168 Installation::Scope Installation::scope() const 00169 { 00170 return d->m_scope; 00171 } 00172