taskbartest.cpp
00001 /* 00002 * Copyright (C) 2003 Hans Karlsson <karlsson.h@home.se> 00003 * Copyright (C) 2003-2004 Adam Geitgey <adam@rootnode.org> 00004 * Copyright (c) 2005 Ryan Nickell <p0z3r@earthlink.net> 00005 * 00006 * This file is part of SuperKaramba. 00007 * 00008 * SuperKaramba is free software; you can redistribute it and/or modify 00009 * it under the terms of the GNU General Public License as published by 00010 * the Free Software Foundation; either version 2 of the License, or 00011 * (at your option) any later version. 00012 * 00013 * SuperKaramba is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU General Public License 00019 * along with SuperKaramba; if not, write to the Free Software 00020 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00021 ****************************************************************************/ 00022 00023 #include <kapplication.h> 00024 #include <kfiledialog.h> 00025 #include <kaboutdata.h> 00026 #include <kcmdlineargs.h> 00027 #include <klocale.h> 00028 #include <kconfig.h> 00029 00030 #include <tqfileinfo.h> 00031 #include <tqstringlist.h> 00032 00033 #include <iostream.h> 00034 00035 #include "taskbartest.h" 00036 00037 static const char *description = 00038 I18N_NOOP("A KDE Eye-candy Application"); 00039 00040 static const char *version = "0.17"; 00041 00042 static KCmdLineOptions options[] = 00043 { 00044 // { "+[URL]", I18N_NOOP( "Document to open" ), 0 }, 00045 { "+file", I18N_NOOP("A required argument 'file'"), 0 }, 00046 { 0, 0, 0 } 00047 00048 }; 00049 00050 00051 int main(int argc, char **argv) 00052 { 00053 KAboutData about("karamba", I18N_NOOP("karamba"), version, description, 00054 KAboutData::License_GPL, "(C) 2003 Hans Karlsson", 0, 0, "karlsson.h@home.se"); 00055 about.addAuthor( "Hans Karlsson", 0, "karlsson.h@home.se" ); 00056 KCmdLineArgs::init(argc, argv, &about); 00057 KCmdLineArgs::addCmdLineOptions( options ); 00058 00059 KApplication app; 00060 // karamba *mainWin = 0; 00061 00062 KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); 00063 00064 // //KSGRD::SensorManager *f32 = new KSGRD::SensorManager(); 00065 // //f32->engage("localhost"); 00066 // // KSGRD::SensorMgr foo ;// p->engage( "" ); 00067 00068 00069 // //KConfig *kconfig = KGlobal::config(); 00070 // //kconfig->setGroup("karamba"); 00071 // //kconfig->writeEntry("test", "/home/hk/foofoo"); 00072 // //kconfig->sync(); 00073 00074 00075 // bool OK = false; 00076 00077 // // initialize Python 00078 // Py_Initialize(); 00079 00080 // // initialize thread support 00081 // PyEval_InitThreads(); 00082 00083 // mainThreadState = NULL; 00084 00085 // // save a pointer to the main PyThreadState object 00086 // mainThreadState = PyThreadState_Get(); 00087 00088 // // release the lock 00089 // PyEval_ReleaseLock(); 00090 00091 00092 // if(args->count() > 0) 00093 // { 00094 // for (int i = 0; i < (args->count()); i++) 00095 // { 00096 // if( args->arg(i) != "" ) 00097 // { 00098 // TQFileInfo file( args->arg(i) ); 00099 // //qDebug( file.dirPath(true) ); 00100 // if( file.exists() && !file.isDir() ) 00101 // { 00102 // //qDebug( "File exists" ); 00103 // mainWin = new karamba( ( args->arg(i) )); 00104 // mainWin->show(); 00105 // OK = true; 00106 // } 00107 // } 00108 // } 00109 00110 // //app.setMainWidget( mainWin ); 00111 // int ret = 0; 00112 // if( OK ) 00113 // ret = app.exec(); 00114 00115 // // shut down the interpreter 00116 // PyInterpreterState * mainInterpreterState = mainThreadState->interp; 00117 // // create a thread state object for this thread 00118 // PyThreadState * myThreadState = PyThreadState_New(mainInterpreterState); 00119 // PyThreadState_Swap(myThreadState); 00120 00121 // PyEval_AcquireLock(); 00122 // Py_Finalize(); 00123 00124 // return ret; 00125 // } 00126 // else 00127 // { 00128 // TQStringList fileNames; 00129 // fileNames = KFileDialog::getOpenFileNames(TQString(), "*.theme", 0, "Open configurations"); 00130 // for ( TQStringList::Iterator it = fileNames.begin(); it != fileNames.end(); ++it ) 00131 // { 00132 // TQFileInfo file( *it ); 00133 // if( file.exists() && !file.isDir() ) 00134 // { 00135 // mainWin = new karamba( *it ); 00136 // mainWin->show(); 00137 // OK = true; 00138 // } 00139 // } 00140 // int ret = 0; 00141 // if( OK ) 00142 // ret = app.exec(); 00143 00144 // // shut down the interpreter 00145 // PyInterpreterState * mainInterpreterState = mainThreadState->interp; 00146 // // create a thread state object for this thread 00147 // PyThreadState * myThreadState = PyThreadState_New(mainInterpreterState); 00148 // PyThreadState_Swap(myThreadState); 00149 // PyEval_AcquireLock(); 00150 // Py_Finalize(); 00151 // return ret; 00152 // } 00153 00154 // args->clear(); 00155 00156 // // shut down the interpreter 00157 00158 // PyInterpreterState * mainInterpreterState = mainThreadState->interp; 00159 // // create a thread state object for this thread 00160 // PyThreadState * myThreadState = PyThreadState_New(mainInterpreterState); 00161 // PyThreadState_Swap(myThreadState); 00162 // PyEval_AcquireLock(); 00163 // Py_Finalize(); 00164 00165 00166 TaskManager t; 00167 00168 printf("%d %d", t.numberOfDesktops(), t.currentDesktop()); 00169 00170 TaskList list = t.tasks(); 00171 00172 Task *task; 00173 for ( task = list.first(); task; task = list.next() ) { 00174 cout << task->name().latin1() << endl; 00175 task->restore(); 00176 } 00177 cout << endl; 00178 00179 return 0; 00180 00181 00182 00183 }