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 Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 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 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public License 00016 along with this library; see the file COPYING.LIB. If not, write to 00017 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00018 Boston, MA 02110-1301, USA. 00019 */ 00020 00021 #include "installation.h" 00022 00023 struct KNS::InstallationPrivate { 00024 InstallationPrivate() { 00025 m_checksumpolicy = Installation::CheckIfPossible; 00026 m_signaturepolicy = Installation::CheckIfPossible; 00027 m_scope = Installation::ScopeUser; 00028 m_customname = false; 00029 } 00030 00031 QString m_command; 00032 QString m_uncompression; 00033 QString m_standardresourcedir; 00034 QString m_targetdir; 00035 QString m_installpath; 00036 QString m_absoluteinstallpath; 00037 Installation::Policy m_checksumpolicy; 00038 Installation::Policy m_signaturepolicy; 00039 Installation::Scope m_scope; 00040 bool m_customname; 00041 }; 00042 00043 using namespace KNS; 00044 00045 Installation::Installation() 00046 : d(new InstallationPrivate) 00047 { 00048 } 00049 00050 Installation::~Installation() 00051 { 00052 delete d; 00053 } 00054 00055 void Installation::setUncompression(const QString& uncompression) 00056 { 00057 d->m_uncompression = uncompression; 00058 } 00059 00060 void Installation::setCommand(const QString& command) 00061 { 00062 d->m_command = command; 00063 } 00064 00065 void Installation::setStandardResourceDir(const QString& dir) 00066 { 00067 d->m_standardresourcedir = dir; 00068 } 00069 00070 void Installation::setTargetDir(const QString& dir) 00071 { 00072 d->m_targetdir = dir; 00073 } 00074 00075 void Installation::setInstallPath(const QString& dir) 00076 { 00077 d->m_installpath = dir; 00078 } 00079 00080 void Installation::setAbsoluteInstallPath(const QString& dir) 00081 { 00082 d->m_absoluteinstallpath = dir; 00083 } 00084 00085 void Installation::setChecksumPolicy(Policy policy) 00086 { 00087 d->m_checksumpolicy = policy; 00088 } 00089 00090 void Installation::setSignaturePolicy(Policy policy) 00091 { 00092 d->m_signaturepolicy = policy; 00093 } 00094 00095 void Installation::setScope(Scope scope) 00096 { 00097 d->m_scope = scope; 00098 } 00099 00100 void Installation::setCustomName(bool customname) 00101 { 00102 d->m_customname = customname; 00103 } 00104 00105 QString Installation::uncompression() const 00106 { 00107 return d->m_uncompression; 00108 } 00109 00110 QString Installation::command() const 00111 { 00112 return d->m_command; 00113 } 00114 00115 QString Installation::standardResourceDir() const 00116 { 00117 return d->m_standardresourcedir; 00118 } 00119 00120 QString Installation::targetDir() const 00121 { 00122 return d->m_targetdir; 00123 } 00124 00125 QString Installation::installPath() const 00126 { 00127 return d->m_installpath; 00128 } 00129 00130 QString Installation::absoluteInstallPath() const 00131 { 00132 return d->m_absoluteinstallpath; 00133 } 00134 00135 bool Installation::isRemote() const 00136 { 00137 if (!installPath().isEmpty()) return false; 00138 if (!targetDir().isEmpty()) return false; 00139 if (!absoluteInstallPath().isEmpty()) return false; 00140 if (!standardResourceDir().isEmpty()) return false; 00141 return true; 00142 } 00143 00144 Installation::Policy Installation::checksumPolicy() const 00145 { 00146 return d->m_checksumpolicy; 00147 } 00148 00149 Installation::Policy Installation::signaturePolicy() const 00150 { 00151 return d->m_signaturepolicy; 00152 } 00153 00154 bool Installation::customName() const 00155 { 00156 return d->m_customname; 00157 } 00158 00159 Installation::Scope Installation::scope() const 00160 { 00161 return d->m_scope; 00162 } 00163