ghns.cpp
00001 /* 00002 This file is part of KDE. 00003 00004 Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org> 00005 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Library General Public 00008 License as published by the Free Software Foundation; either 00009 version 2 of the License, or (at your option) any later version. 00010 00011 This library is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 Library General Public License for more details. 00015 00016 You should have received a copy of the GNU Library General Public License 00017 along with this library; see the file COPYING.LIB. If not, write to 00018 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00019 Boston, MA 02110-1301, USA. 00020 */ 00021 #include <iostream> 00022 00023 #include <tqlayout.h> 00024 #include <tqfile.h> 00025 #include <tqtextstream.h> 00026 #include <tqlabel.h> 00027 00028 #include <kaboutdata.h> 00029 #include <kapplication.h> 00030 #include <kdebug.h> 00031 #include <klocale.h> 00032 #include <kcmdlineargs.h> 00033 #include <kprocess.h> 00034 #include <kdialog.h> 00035 00036 #include "knewstuffgeneric.h" 00037 00038 #include "ghns.h" 00039 00040 using namespace std; 00041 00042 GhnsWidget::GhnsWidget() 00043 { 00044 mWallpapers = new KNewStuffGeneric( "kdesktop/wallpaper", this ); 00045 00046 TQBoxLayout *topLayout = new TQVBoxLayout( this ); 00047 topLayout->setMargin( KDialog::marginHint() ); 00048 topLayout->setSpacing( KDialog::spacingHint() ); 00049 00050 topLayout->addWidget( new TQLabel( i18n("Get hot new stuff:"), this ) ); 00051 00052 TQPushButton *button = new TQPushButton( "Wallpapers", this ); 00053 topLayout->addWidget( button ); 00054 connect( button, TQT_SIGNAL( clicked() ), TQT_SLOT( downloadWallpapers() ) ); 00055 00056 topLayout->addSpacing( 5 ); 00057 00058 TQBoxLayout *buttonLayout = new TQHBoxLayout( topLayout ); 00059 00060 buttonLayout->addStretch(); 00061 00062 TQPushButton *closeButton = new TQPushButton( "Close", this ); 00063 buttonLayout->addWidget( closeButton ); 00064 connect( closeButton, TQT_SIGNAL( clicked() ), kapp, TQT_SLOT( quit() ) ); 00065 } 00066 00067 GhnsWidget::~GhnsWidget() 00068 { 00069 delete mWallpapers; 00070 } 00071 00072 void GhnsWidget::downloadWallpapers() 00073 { 00074 kdDebug() << "downloadWallpapers()" << endl; 00075 00076 mWallpapers->download(); 00077 } 00078 00079 int main(int argc,char **argv) 00080 { 00081 KAboutData aboutData("ghns","Get Hot New Stuff","0.1"); 00082 KCmdLineArgs::init(argc,argv,&aboutData); 00083 00084 KApplication app; 00085 00086 GhnsWidget wid; 00087 app.setMainWidget( &wid ); 00088 wid.show(); 00089 00090 app.exec(); 00091 } 00092 00093 #include "ghns.moc"