kexi

kexinewstuff.cpp
1/* This file is part of the KDE project
2 Copyright (C) 2004 Cedric Pasteur <cedric.pasteur@free.fr>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library 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 GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18*/
19
20#ifdef HAVE_TDENEWSTUFF
21
22#include <kdebug.h>
23#include <ktar.h>
24#include <tqdir.h>
25#include <tdeaction.h>
26#include <tdeapplication.h>
27#include <tdefiledialog.h>
28#include <tdelocale.h>
29#include <tdeversion.h>
30
31#include "kexinewstuff.h"
32
33KexiNewStuff::KexiNewStuff(TQWidget *parent)
34 : TDENewStuff( "kexi template"
35#if KDE_IS_VERSION(3,3,0)
36 , "https://www.trinitydesktop.org/ocs/providers.xml"
37#endif
38 , parent)
39{
40 // Prevent GHNS to deny downloading a second time. If GHNS
41 // fails to download something, it still marks the thing as
42 // successfully downloaded and therefore we arn't able to
43 // download it again :-/
44 TDEGlobal::config()->deleteGroup("TDENewStuffStatus");
45}
46
47KexiNewStuff::~KexiNewStuff()
48{
49}
50
51bool
52KexiNewStuff::install(const TQString &fileName)
53{
54 kdDebug() << "KexiNewStuff::install(): " << fileName << endl;
55
56 KTar archive( fileName );
57 if ( !archive.open( IO_ReadOnly ) ) {
58 kdDebug() << TQString("KexiNewStuff::install: Failed to open archivefile \"%1\"").arg(fileName) << endl;
59 return false;
60 }
61 const KArchiveDirectory *archiveDir = archive.directory();
62 const TQString destDir = KFileDialog::getExistingDirectory(
63 ":DownloadExampleDatabases", parentWidget(),
64 i18n("Choose Directory Where to Install Example Database"));
65 if (destDir.isEmpty()) {
66 kdDebug() << TQString("KexiNewStuff::install: Destination-directory is empty.") << endl;
67 return false;
68 }
69 archiveDir->copyTo(destDir);
70 archive.close();
71
72 return true;
73}
74
75bool
76KexiNewStuff::createUploadFile(const TQString &)
77{
78 return true;
79}
80
81#endif