summaryrefslogtreecommitdiffabout
path: root/microkde
authorzautrix <zautrix>2004-08-06 10:53:41 (UTC)
committer zautrix <zautrix>2004-08-06 10:53:41 (UTC)
commitcde989298c4891f54ad70ae03080ac8fa57b5c3f (patch) (unidiff)
tree945e4d75d5c6f2a6a2ebed6e50a6a1a769e4366c /microkde
parent841ce8881dbeee8a10dea8b96f82addd28f52536 (diff)
downloadkdepimpi-cde989298c4891f54ad70ae03080ac8fa57b5c3f.zip
kdepimpi-cde989298c4891f54ad70ae03080ac8fa57b5c3f.tar.gz
kdepimpi-cde989298c4891f54ad70ae03080ac8fa57b5c3f.tar.bz2
Added licence menu in kopi
Diffstat (limited to 'microkde') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kapplication.cpp44
-rw-r--r--microkde/kapplication.h1
2 files changed, 44 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 @@
1#include <stdlib.h> 1#include <stdlib.h>
2#include <stdio.h>
2 3
3#include "kapplication.h" 4#include "kapplication.h"
4#include <qapplication.h> 5#include <qapplication.h>
6#include <qstring.h>
7#include <qfile.h>
8#include <qtextstream.h>
9#include <qdialog.h>
10#include <qlayout.h>
11#include <qtextbrowser.h>
5 12
6int KApplication::random() 13int KApplication::random()
7{ 14{
8 return rand(); 15 return rand();
9} 16}
10 17
11//US 18//US
12QString KApplication::randomString(int length) 19QString KApplication::randomString(int length)
13{ 20{
14 if (length <=0 ) return QString::null; 21 if (length <=0 ) return QString::null;
15 22
16 QString str; 23 QString str;
17 while (length--) 24 while (length--)
18 { 25 {
19 int r=random() % 62; 26 int r=random() % 62;
20 r+=48; 27 r+=48;
21 if (r>57) r+=7; 28 if (r>57) r+=7;
22 if (r>90) r+=6; 29 if (r>90) r+=6;
23 str += char(r); 30 str += char(r);
24 // so what if I work backwards? 31 // so what if I work backwards?
25 } 32 }
26 return str; 33 return str;
27} 34}
28 int KApplication::execDialog( QDialog* d ) 35int KApplication::execDialog( QDialog* d )
29{ 36{
30 if (QApplication::desktop()->width() <= 640 ) 37 if (QApplication::desktop()->width() <= 640 )
31 d->showMaximized(); 38 d->showMaximized();
32 return d->exec(); 39 return d->exec();
33} 40}
41void KApplication::showLicence()
42{
43 QString fileName ;
44 QString text;
45#ifndef DESKTOP_VERSION
46 fileName = getenv("QPEDIR");
47 fileName += "/pics/kdepim/LICENCE.TXT" ;
48#else
49 fileName = qApp->applicationDirPath () + "/kdepim/LICENCE.TXT";
50#endif
51 QFile file( fileName );
52 qDebug("Licence file name %s ",fileName.latin1() );
53 if (!file.open( IO_ReadOnly ) ) {
54 return ;
55 }
56 QTextStream ts( &file );
57 text = ts.read();
58 file.close();
59
60 QDialog dia( 0, "name", true ); ;
61 dia.setCaption( "KDE-Pim/Pi licence" );
62 QVBoxLayout* lay = new QVBoxLayout( &dia );
63 lay->setSpacing( 3 );
64 lay->setMargin( 3 );
65 QTextBrowser tb ( &dia );
66 lay->addWidget( &tb );
67 tb.setText( text );
68#ifdef DESKTOP_VERSION
69 dia.resize( 640, 480);
70#else
71 dia.showMaximized();
72#endif
73 dia.exec();
74
75}
diff --git a/microkde/kapplication.h b/microkde/kapplication.h
index 77206f5..9515c60 100644
--- a/microkde/kapplication.h
+++ b/microkde/kapplication.h
@@ -4,20 +4,21 @@
4#include "qstring.h" 4#include "qstring.h"
5#include <qdialog.h> 5#include <qdialog.h>
6 6
7class KApplication 7class KApplication
8{ 8{
9 public: 9 public:
10 static int random(); 10 static int random();
11 11
12//US 12//US
13 /** 13 /**
14 * Generates a random string. It operates in the range [A-Za-z0-9] 14 * Generates a random string. It operates in the range [A-Za-z0-9]
15 * @param length Generate a string of this length. 15 * @param length Generate a string of this length.
16 * @return the random string 16 * @return the random string
17 */ 17 */
18 static QString randomString(int length); 18 static QString randomString(int length);
19 static int execDialog( QDialog* ); 19 static int execDialog( QDialog* );
20 static void showLicence();
20}; 21};
21 22
22 23
23#endif 24#endif