summaryrefslogtreecommitdiffabout
path: root/microkde
authorzautrix <zautrix>2004-08-06 21:32:25 (UTC)
committer zautrix <zautrix>2004-08-06 21:32:25 (UTC)
commitacc0637eb0965d66b96d138d74514acf2cf24792 (patch) (side-by-side diff)
tree6787abd671406bbdeb2e3387aa39ba4806d84689 /microkde
parent2087f0a25354897ff9b987093e1c6716d7bd967b (diff)
downloadkdepimpi-acc0637eb0965d66b96d138d74514acf2cf24792.zip
kdepimpi-acc0637eb0965d66b96d138d74514acf2cf24792.tar.gz
kdepimpi-acc0637eb0965d66b96d138d74514acf2cf24792.tar.bz2
more licence stuff
Diffstat (limited to 'microkde') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kapplication.cpp52
-rw-r--r--microkde/kapplication.h1
2 files changed, 29 insertions, 24 deletions
diff --git a/microkde/kapplication.cpp b/microkde/kapplication.cpp
index f0de71e..ad0b78e 100644
--- a/microkde/kapplication.cpp
+++ b/microkde/kapplication.cpp
@@ -19,57 +19,61 @@ int KApplication::random()
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 )
{
if (QApplication::desktop()->width() <= 640 )
d->showMaximized();
return d->exec();
}
void KApplication::showLicence()
{
- QString fileName ;
- QString text;
+ KApplication::showFile( "KDE-Pim/Pi licence", "kdepim/LICENCE.TXT" );
+}
+
+void KApplication::showFile(QString caption, QString fn)
+{
+ QString text;
+ QString fileName;
#ifndef DESKTOP_VERSION
fileName = getenv("QPEDIR");
- fileName += "/pics/kdepim/LICENCE.TXT" ;
+ fileName += "/pics/" + fn ;
#else
- fileName = qApp->applicationDirPath () + "/kdepim/LICENCE.TXT";
+ fileName = qApp->applicationDirPath () + "/" + fn;
#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 );
+ QFile file( fileName );
+ if (!file.open( IO_ReadOnly ) ) {
+ return ;
+ }
+ QTextStream ts( &file );
+ text = ts.read();
+ file.close();
+
+ QDialog dia( 0, "name", true ); ;
+ dia.setCaption( caption );
+ 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);
+ dia.resize( 640, 480);
#else
- dia.showMaximized();
+ dia.showMaximized();
#endif
- dia.exec();
+ dia.exec();
}
diff --git a/microkde/kapplication.h b/microkde/kapplication.h
index 9515c60..5ae5c00 100644
--- a/microkde/kapplication.h
+++ b/microkde/kapplication.h
@@ -1,24 +1,25 @@
#ifndef MINIKDE_KAPPLICATION_H
#define MINIKDE_KAPPLICATION_H
#include "qstring.h"
#include <qdialog.h>
class KApplication
{
public:
static int random();
//US
/**
* Generates a random string. It operates in the range [A-Za-z0-9]
* @param length Generate a string of this length.
* @return the random string
*/
static QString randomString(int length);
static int execDialog( QDialog* );
static void showLicence();
+ static void showFile(QString caption, QString file);
};
#endif