author | zautrix <zautrix> | 2004-08-06 10:53:41 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-08-06 10:53:41 (UTC) |
commit | cde989298c4891f54ad70ae03080ac8fa57b5c3f (patch) (side-by-side diff) | |
tree | 945e4d75d5c6f2a6a2ebed6e50a6a1a769e4366c /microkde/kapplication.cpp | |
parent | 841ce8881dbeee8a10dea8b96f82addd28f52536 (diff) | |
download | kdepimpi-cde989298c4891f54ad70ae03080ac8fa57b5c3f.zip kdepimpi-cde989298c4891f54ad70ae03080ac8fa57b5c3f.tar.gz kdepimpi-cde989298c4891f54ad70ae03080ac8fa57b5c3f.tar.bz2 |
Added licence menu in kopi
-rw-r--r-- | microkde/kapplication.cpp | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/microkde/kapplication.cpp b/microkde/kapplication.cpp index 1b3e689..f0de71e 100644 --- a/microkde/kapplication.cpp +++ b/microkde/kapplication.cpp @@ -1,33 +1,75 @@ #include <stdlib.h> +#include <stdio.h> #include "kapplication.h" #include <qapplication.h> +#include <qstring.h> +#include <qfile.h> +#include <qtextstream.h> +#include <qdialog.h> +#include <qlayout.h> +#include <qtextbrowser.h> int KApplication::random() { return rand(); } //US QString KApplication::randomString(int length) { if (length <=0 ) return QString::null; QString str; while (length--) { int r=random() % 62; r+=48; if (r>57) r+=7; if (r>90) r+=6; str += char(r); // so what if I work backwards? } return str; } - int KApplication::execDialog( QDialog* d ) +int KApplication::execDialog( QDialog* d ) { if (QApplication::desktop()->width() <= 640 ) d->showMaximized(); return d->exec(); } +void KApplication::showLicence() +{ + QString fileName ; + QString text; +#ifndef DESKTOP_VERSION + fileName = getenv("QPEDIR"); + fileName += "/pics/kdepim/LICENCE.TXT" ; +#else + fileName = qApp->applicationDirPath () + "/kdepim/LICENCE.TXT"; +#endif + QFile file( fileName ); + qDebug("Licence file name %s ",fileName.latin1() ); + if (!file.open( IO_ReadOnly ) ) { + return ; + } + QTextStream ts( &file ); + text = ts.read(); + file.close(); + + QDialog dia( 0, "name", true ); ; + dia.setCaption( "KDE-Pim/Pi licence" ); + QVBoxLayout* lay = new QVBoxLayout( &dia ); + lay->setSpacing( 3 ); + lay->setMargin( 3 ); + QTextBrowser tb ( &dia ); + lay->addWidget( &tb ); + tb.setText( text ); +#ifdef DESKTOP_VERSION + dia.resize( 640, 480); +#else + dia.showMaximized(); +#endif + dia.exec(); + +} |