summaryrefslogtreecommitdiffabout
path: root/microkde/kapplication.cpp
authorzautrix <zautrix>2005-10-22 14:12:43 (UTC)
committer zautrix <zautrix>2005-10-22 14:12:43 (UTC)
commita72d70beb381b9cd6f2af301b52ca82cdcafb299 (patch) (unidiff)
treef5b068e80395821abb5717fb07757a17d805f770 /microkde/kapplication.cpp
parenta72f3f3acfac791715a1c512fc4cc4c3facdbb62 (diff)
downloadkdepimpi-a72d70beb381b9cd6f2af301b52ca82cdcafb299.zip
kdepimpi-a72d70beb381b9cd6f2af301b52ca82cdcafb299.tar.gz
kdepimpi-a72d70beb381b9cd6f2af301b52ca82cdcafb299.tar.bz2
fix
Diffstat (limited to 'microkde/kapplication.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kapplication.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/microkde/kapplication.cpp b/microkde/kapplication.cpp
index f36c5ae..d7c12bb 100644
--- a/microkde/kapplication.cpp
+++ b/microkde/kapplication.cpp
@@ -22,71 +22,73 @@ QString KApplication::randomString(int length)
22{ 22{
23 if (length <=0 ) return QString::null; 23 if (length <=0 ) return QString::null;
24 24
25 QString str; 25 QString str;
26 while (length--) 26 while (length--)
27 { 27 {
28 int r=random() % 62; 28 int r=random() % 62;
29 r+=48; 29 r+=48;
30 if (r>57) r+=7; 30 if (r>57) r+=7;
31 if (r>90) r+=6; 31 if (r>90) r+=6;
32 str += char(r); 32 str += char(r);
33 // so what if I work backwards? 33 // so what if I work backwards?
34 } 34 }
35 return str; 35 return str;
36} 36}
37int KApplication::execDialog( QDialog* d ) 37int KApplication::execDialog( QDialog* d )
38{ 38{
39 if (QApplication::desktop()->width() <= 640 ) 39 if (QApplication::desktop()->width() <= 640 )
40 d->showMaximized(); 40 d->showMaximized();
41 else 41 else
42 ;//d->resize( 800, 600 ); 42 ;//d->resize( 800, 600 );
43 return d->exec(); 43 return d->exec();
44} 44}
45void KApplication::showLicence() 45void KApplication::showLicence()
46{ 46{
47 KApplication::showFile( "KDE-Pim/Pi licence", "kdepim/licence.txt" ); 47 KApplication::showFile( "KDE-Pim/Pi licence", "kdepim/licence.txt" );
48} 48}
49 49
50void KApplication::testCoords( int* x, int* y, int* wid, int * hei ) 50void KApplication::testCoords( int* x, int* y, int* wid, int * hei )
51{ 51{
52 int dWid = QApplication::desktop()->width() ; 52 int dWid = QApplication::desktop()->width() ;
53 int dHei = QApplication::desktop()->height(); 53 int dHei = QApplication::desktop()->height();
54 if ( *x < 0 ) *x = 0;
55 if ( *y < 20 ) *y = 20 ;
54 if ( *x + *wid > dWid ) { 56 if ( *x + *wid > dWid ) {
55 *x = 0; 57 *x = 0;
56 if ( *wid > dWid ) 58 if ( *wid > dWid )
57 *wid = dWid; 59 *wid = dWid;
58 } 60 }
59 if ( *y + *hei > dHei ) { 61 if ( *y + *hei > dHei ) {
60 *y = 0; 62 *y = 20;
61 if ( *hei > dHei ) 63 if ( *hei > dHei )
62 *hei = dHei; 64 *hei = dHei;
63 } 65 }
64} 66}
65void KApplication::showFile(QString caption, QString fn) 67void KApplication::showFile(QString caption, QString fn)
66{ 68{
67 QString text; 69 QString text;
68 QString fileName; 70 QString fileName;
69#ifndef DESKTOP_VERSION 71#ifndef DESKTOP_VERSION
70 fileName = getenv("QPEDIR"); 72 fileName = getenv("QPEDIR");
71 fileName += "/pics/" + fn ; 73 fileName += "/pics/" + fn ;
72#else 74#else
73 fileName = qApp->applicationDirPath () + "/" + fn; 75 fileName = qApp->applicationDirPath () + "/" + fn;
74#endif 76#endif
75 QFile file( fileName ); 77 QFile file( fileName );
76 if (!file.open( IO_ReadOnly ) ) { 78 if (!file.open( IO_ReadOnly ) ) {
77 return ; 79 return ;
78 } 80 }
79 QTextStream ts( &file ); 81 QTextStream ts( &file );
80 text = ts.read(); 82 text = ts.read();
81 file.close(); 83 file.close();
82 KApplication::showText( caption, text ); 84 KApplication::showText( caption, text );
83 85
84} 86}
85 87
86bool KApplication::convert2latin1(QString fileName) 88bool KApplication::convert2latin1(QString fileName)
87{ 89{
88 QString text; 90 QString text;
89 QFile file( fileName ); 91 QFile file( fileName );
90 if (!file.open( IO_ReadOnly ) ) { 92 if (!file.open( IO_ReadOnly ) ) {
91 return false; 93 return false;
92 94