knewstuff Library: ghns.cpp Source File (knewstuff Library)

| # knewstuff Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# 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., 59 Temple Place - Suite 330,
    00019     Boston, MA 02111-1307, USA.
    00020 */
    00021 #include <iostream>
    00022
    00023 #include <qlayout.h>
    00024 #include <qfile.h>
    00025 #include <qtextstream.h>
    00026 #include <qlabel.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   QBoxLayout *topLayout = new QVBoxLayout( this );
    00047   topLayout->setMargin( KDialog::marginHint() );
    00048   topLayout->setSpacing( KDialog::spacingHint() );
    00049
    00050   topLayout->addWidget( new QLabel( i18n("Get hot new stuff:"), this ) );
    00051
    00052   QPushButton *button = new QPushButton( "Wallpapers", this );
    00053   topLayout->addWidget( button );
    00054   connect( button, SIGNAL( clicked() ), SLOT( downloadWallpapers() ) );
    00055
    00056   topLayout->addSpacing( 5 );
    00057
    00058   QBoxLayout *buttonLayout = new QHBoxLayout( topLayout );
    00059
    00060   buttonLayout->addStretch();
    00061
    00062   QPushButton *closeButton = new QPushButton( "Close", this );
    00063   buttonLayout->addWidget( closeButton );
    00064   connect( closeButton, SIGNAL( clicked() ), kapp, SLOT( quit() ) );
    00065 }
    00066
    00067 GhnsWidget::~GhnsWidget()
    00068 {
    00069   delete mWallpapers;
    00070 }
    00071
    00072 void GhnsWidget::downloadWallpapers()
    00073 {
    00074   kdDebug(5850) << "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"

This file is part of the documentation for knewstuff Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:28:34 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003