• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdenewstuff
 

tdenewstuff

  • tdenewstuff
testnewstuff.cpp
1 /*
2  This file is part of KOrganizer.
3  Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org>
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Library General Public
7  License as published by the Free Software Foundation; either
8  version 2 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Library General Public License for more details.
14 
15  You should have received a copy of the GNU Library General Public License
16  along with this library; see the file COPYING.LIB. If not, write to
17  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  Boston, MA 02110-1301, USA.
19 */
20 
21 #include <iostream>
22 
23 #include <tqlayout.h>
24 #include <tqfile.h>
25 #include <tqtextstream.h>
26 
27 #include <tdeaboutdata.h>
28 #include <tdeapplication.h>
29 #include <kdebug.h>
30 #include <tdelocale.h>
31 #include <tdecmdlineargs.h>
32 #include <kprocess.h>
33 #include <kdialog.h>
34 
35 #include "testnewstuff.h"
36 #include "testnewstuff.moc"
37 
38 using namespace std;
39 
40 bool TestNewStuff::install( const TQString &fileName )
41 {
42  kdDebug() << "TestNewStuff::install(): " << fileName << endl;
43  TQFile f( fileName );
44  if ( !f.open( IO_ReadOnly ) ) {
45  kdDebug() << "Error opening file." << endl;
46  return false;
47  }
48  TQTextStream ts( &f );
49  kdDebug() << "--BEGIN-NEW_STUFF--" << endl;
50  cout << ts.read().utf8();
51  kdDebug() << "---END-NEW_STUFF---" << endl;
52  return true;
53 }
54 
55 bool TestNewStuff::createUploadFile( const TQString &fileName )
56 {
57  TDEProcess p;
58  p << "touch" << fileName;
59  p.start(TDEProcess::Block);
60  kdDebug() << "TestNewStuff::createUploadFile(): " << fileName << endl;
61  return true;
62 }
63 
64 
65 MyWidget::MyWidget()
66 {
67  mNewStuff = new TestNewStuff;
68 
69  TQBoxLayout *topLayout = new TQVBoxLayout( this );
70  topLayout->setMargin( KDialog::marginHint() );
71  topLayout->setSpacing( KDialog::spacingHint() );
72 
73  TQPushButton *downloadButton = new TQPushButton( "Download", this );
74  topLayout->addWidget( downloadButton );
75  connect( downloadButton, TQT_SIGNAL( clicked() ), TQT_SLOT( download() ) );
76 
77  TQPushButton *uploadButton = new TQPushButton( "Upload", this );
78  topLayout->addWidget( uploadButton );
79  connect( uploadButton, TQT_SIGNAL( clicked() ), TQT_SLOT( upload() ) );
80 
81  topLayout->addSpacing( 5 );
82 
83  TQPushButton *closeButton = new TQPushButton( "Close", this );
84  topLayout->addWidget( closeButton );
85  connect( closeButton, TQT_SIGNAL( clicked() ), kapp, TQT_SLOT( quit() ) );
86 }
87 
88 MyWidget::~MyWidget()
89 {
90  delete mNewStuff;
91 }
92 
93 void MyWidget::download()
94 {
95  kdDebug() << "MyWidget::download()" << endl;
96 
97  mNewStuff->download();
98 }
99 
100 void MyWidget::upload()
101 {
102  kdDebug() << "MyWidget::download()" << endl;
103 
104  mNewStuff->upload();
105 }
106 
107 
108 int main(int argc,char **argv)
109 {
110  TDEAboutData aboutData("knewstufftest","TDENewStuff Test","0.1");
111  TDECmdLineArgs::init(argc,argv,&aboutData);
112 
113  TDEApplication app;
114 
115  MyWidget wid;
116  app.setMainWidget( &wid );
117  wid.show();
118 
119  app.exec();
120 }
std

tdenewstuff

Skip menu "tdenewstuff"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

tdenewstuff

Skip menu "tdenewstuff"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  •     tdecore
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  • tdeioslave
  •   http
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdenewstuff by doxygen 1.8.8
This website is maintained by Timothy Pearson.