summaryrefslogtreecommitdiff
path: root/noncore
Side-by-side diff
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/applets/zkbapplet/applet/zkbwidget.cpp2
-rw-r--r--noncore/applets/zkbapplet/keyzcfg/cfgdlg.cpp4
-rw-r--r--noncore/applets/zkbapplet/keyzcfg/main.cpp2
-rw-r--r--noncore/apps/opie-bartender/bartender.cpp2
-rw-r--r--noncore/apps/opie-console/fixit.cpp6
-rw-r--r--noncore/apps/opie-gutenbrowser/LibraryDialog.cpp6
-rw-r--r--noncore/apps/opie-gutenbrowser/ftpsitedlg.cpp2
-rw-r--r--noncore/apps/opie-gutenbrowser/gutenbrowser.cpp4
-rw-r--r--noncore/apps/opie-gutenbrowser/helpme.cpp2
-rw-r--r--noncore/apps/zsafe/zsafe.cpp10
-rw-r--r--noncore/games/backgammon/backgammon.cpp14
-rw-r--r--noncore/games/backgammon/filedialog.cpp2
-rw-r--r--noncore/games/backgammon/themedialog.cpp2
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp2
-rw-r--r--noncore/settings/language/language.cpp2
-rw-r--r--noncore/settings/networksettings/mainwindow/mainwindowimp.cpp2
-rw-r--r--noncore/settings/sysinfo/benchmarkinfo.cpp2
-rw-r--r--noncore/settings/tabmanager/tabmanager.cpp4
-rw-r--r--noncore/styles/theme/othemebase.cpp2
-rw-r--r--noncore/styles/theme/themeset.cpp2
-rw-r--r--noncore/tools/calc2/calc.cpp2
21 files changed, 38 insertions, 38 deletions
diff --git a/noncore/applets/zkbapplet/applet/zkbwidget.cpp b/noncore/applets/zkbapplet/applet/zkbwidget.cpp
index 8499500..13729ea 100644
--- a/noncore/applets/zkbapplet/applet/zkbwidget.cpp
+++ b/noncore/applets/zkbapplet/applet/zkbwidget.cpp
@@ -1,140 +1,140 @@
#include <opie2/otaskbarapplet.h>
#include <opie2/okeyfilter.h>
#include <qpe/qcopenvelope_qws.h>
#include <qpe/applnk.h>
#include <qpe/qpeapplication.h>
#include <qpe/resource.h>
#include <stdio.h>
#include <unistd.h>
#include "zkbwidget.h"
#include "zkbcfg.h"
using namespace Opie::Ui;
ZkbWidget::ZkbWidget(QWidget* parent)
:QLabel(parent),keymap(0),disabled(Resource::loadPixmap("zkb-disabled")) {
labels = new QPopupMenu();
connect(labels, SIGNAL(activated(int)), this,
SLOT(labelChanged(int)));
loadKeymap();
channel = new QCopChannel("QPE/zkb", this);
connect(channel, SIGNAL(received(const QCString&,const QByteArray&)),
this, SLOT(signalReceived(const QCString&,const QByteArray&)));
setFixedWidth ( AppLnk::smallIconSize() );
setFixedHeight ( AppLnk::smallIconSize() );
}
ZkbWidget::~ZkbWidget()
{
if (keymap != 0) {
delete keymap;
keymap = 0;
}
}
int ZkbWidget::position()
{
return 8;
}
bool ZkbWidget::loadKeymap() {
- ZkbConfig c(QPEApplication::qpeDir()+"/share/zkb");
+ ZkbConfig c(QPEApplication::qpeDir()+"share/zkb");
QFontMetrics fm(font());
if (keymap != 0) {
delete keymap;
keymap = 0;
}
Keymap* km = new Keymap();
if (!c.load("zkb.xml", *km, "")) {
delete km;
setPixmap(disabled);
return false;
}
connect(km, SIGNAL(stateChanged(const QString&)),
this, SLOT(stateChanged(const QString&)));
Opie::Core::OKeyFilter::inst()->addHandler(km);
Keymap* oldkm = keymap;
keymap = km;
if (oldkm != 0) {
delete oldkm;
}
QString ltext = keymap->getCurrentLabel();
if (ltext.length()==0) ltext = "??";
setText(ltext);
labels->clear();
QStringList l = keymap->listLabels();
labels->insertItem(disabled, 0, 0);
int n = 1;
w = 0;
for(QStringList::Iterator it = l.begin(); it != l.end();
++it, n++) {
// printf("label: %s\n", (const char*) (*it).utf8());
labels->insertItem(*it, n, n);
int lw = fm.width(*it);
if (lw > w) {
w = lw;
}
}
if (w == 0) {
hide();
} else {
show();
}
return true;
}
QSize ZkbWidget::sizeHint() const {
return QSize(AppLnk::smallIconSize(),AppLnk::smallIconSize());
}
void ZkbWidget::stateChanged(const QString& s) {
// odebug << "stateChanged: " << s.utf8() << "\n" << oendl;
setText(s);
}
void ZkbWidget::labelChanged(int id) {
if (id == 0) {
keymap->disable();
setPixmap(disabled);
return;
}
keymap->enable();
QStringList l = keymap->listLabels();
QString lbl = l[id-1];
// printf("labelChanged: %s\n", (const char*) lbl.utf8());
State* state = keymap->getStateByLabel(lbl);
if (state != 0) {
keymap->setCurrentState(state);
setText(lbl);
}
}
void ZkbWidget::mouseReleaseEvent(QMouseEvent*) {
QSize sh = labels->sizeHint();
QPoint p = mapToGlobal(QPoint((width()-sh.width())/2,-sh.height()));
labels->exec(p);
}
void ZkbWidget::signalReceived(const QCString& msg, const QByteArray& data) {
QDataStream stream(data, IO_ReadOnly);
if (msg == "enable()") {
keymap->enable();
diff --git a/noncore/applets/zkbapplet/keyzcfg/cfgdlg.cpp b/noncore/applets/zkbapplet/keyzcfg/cfgdlg.cpp
index 8d868d4..4190a9e 100644
--- a/noncore/applets/zkbapplet/keyzcfg/cfgdlg.cpp
+++ b/noncore/applets/zkbapplet/keyzcfg/cfgdlg.cpp
@@ -1,132 +1,132 @@
#include <qdir.h>
#include <qpe/qpeapplication.h>
#include <qpe/qcopenvelope_qws.h>
#include <unistd.h>
#include "cfgdlg.h"
CfgDlg::CfgDlg(QWidget* parent, CfgFile* cf, QApplication* app, bool mod):
QDialog(parent, "CfgDlg", mod), cfile(cf), application(app) {
setCaption(tr("keyz configurator"));
QGridLayout* gl = new QGridLayout(this, 7, 5, 5, 5);
QLabel* flabel = new QLabel("Available Keymaps", this);
files = new QListBox(this);
QPushButton* addButton = new QPushButton(">>", this); //add->setText("Add");
connect(addButton, SIGNAL(clicked()), this, SLOT(add()));
QLabel* klabel = new QLabel("Selected Keymaps", this);
keymaps = new QListBox(this);
connect(keymaps, SIGNAL(highlighted(const QString&)), this, SLOT(keymapHighlighted(const QString&)));
QPushButton* delButton = new QPushButton("<<", this); //del->setText("Delete");
connect(delButton, SIGNAL(clicked()), this, SLOT(del()));
QPushButton* slabelButton = new QPushButton("Set Label", this); //apply->setText("Apply");
connect(slabelButton, SIGNAL(clicked()), this, SLOT(setLabel()));
QLabel* l = new QLabel("Label", this);
label = new QLineEdit(this);
QLabel* adlabel = new QLabel("Auto Repeat Delay (ms)", this);
QLabel* aplabel = new QLabel("Auto Repeat Period (ms)", this);
ad = new QSpinBox(50, 5000, 5, this);
ap = new QSpinBox(0, 5000, 5, this);
// QLabel* adms = new QLabel("ms", this);
// QLabel* apms = new QLabel("ms", this);
// QCheckBox* enable = new QCheckBox("Enable", t);
gl->setColStretch(0, 1);
gl->setColStretch(1, 1);
gl->setColStretch(3, 1);
gl->setColStretch(4, 1);
gl->setRowStretch(3, 1);
gl->addMultiCellWidget(flabel, 0, 0, 0, 1);
gl->addMultiCellWidget(klabel, 0, 0, 3, 4);
gl->addMultiCellWidget(files, 1, 3, 0, 1);
gl->addMultiCellWidget(keymaps, 1, 3, 3, 4);
gl->addWidget(addButton, 1, 2);
gl->addWidget(delButton, 2, 2);
gl->addWidget(l, 4, 0);
gl->addWidget(label, 4, 1);
gl->addMultiCellWidget(slabelButton, 4, 4, 3, 4);
gl->addMultiCellWidget(adlabel, 5, 5, 0, 2);
gl->addMultiCellWidget(ad, 5, 5, 3, 4);
// gl->addWidget(adms, 5, 3);
gl->addMultiCellWidget(aplabel, 6, 6, 0, 2);
gl->addMultiCellWidget(ap, 6, 6, 3, 4);
// gl->addWidget(apms, 6, 3);
QList<CfgEntry>& e = cfile->getEntries();
for(uint i = 0; i < e.count(); i++) {
CfgEntry* entry = e.at(i);
keymaps->insertItem(entry->getFile());
m.insert(entry->getFile(), entry->getLabel());
}
- QDir dir(QPEApplication::qpeDir()+"/share/zkb", "*.xml");
+ QDir dir(QPEApplication::qpeDir()+"share/zkb", "*.xml");
QStringList flist = dir.entryList();
QStringList::Iterator sit;
for(sit = flist.begin(); sit != flist.end(); ++sit) {
if (*sit != "common.xml" && *sit != "zkb.xml" && m.find(*sit) == m.end()) {
files->insertItem(*sit);
}
}
ad->setValue(cfile->getAutorepeatDelay());
ap->setValue(cfile->getAutorepeatPeriod());
// gl->addMultiCellWidget(enable, 7, 7, 0, 4);
}
CfgDlg::~CfgDlg() {
}
void CfgDlg::add() {
if (!files->currentText().isEmpty()) {
QString t = files->currentText();
files->removeItem(files->currentItem());
keymaps->insertItem(t);
cfile->replaceEntry(t, "");
m.replace(t, "");
}
}
void CfgDlg::del() {
if (!keymaps->currentText().isEmpty()) {
QString t = keymaps->currentText();
keymaps->removeItem(keymaps->currentItem());
cfile->deleteEntry(t);
files->insertItem(t);
m.remove(files->currentText());
}
}
void CfgDlg::setLabel() {
if (!keymaps->currentText().isEmpty()) {
cfile->replaceEntry(keymaps->currentText(),
label->text());
m.replace(keymaps->currentText(), label->text());
}
}
void CfgDlg::keymapHighlighted(const QString&text) {
label->setText(*m.find(text));
}
void CfgDlg::accept() {
cfile->setAutorepeatDelay(ad->value());
cfile->setAutorepeatPeriod(ap->value());
CfgParser p;
- p.save(QPEApplication::qpeDir()+"/share/zkb/zkb.xml", *cfile);
+ p.save(QPEApplication::qpeDir()+"share/zkb/zkb.xml", *cfile);
QCopEnvelope("QPE/zkb", "reload()");
QDialog::accept();
}
diff --git a/noncore/applets/zkbapplet/keyzcfg/main.cpp b/noncore/applets/zkbapplet/keyzcfg/main.cpp
index 4615562..afd0f6a 100644
--- a/noncore/applets/zkbapplet/keyzcfg/main.cpp
+++ b/noncore/applets/zkbapplet/keyzcfg/main.cpp
@@ -1,22 +1,22 @@
#include <stdio.h>
#include <qpe/qpeapplication.h>
#include <qlayout.h>
#include <qmainwindow.h>
#include "cfgdlg.h"
int main( int argc, char **argv ) {
QPEApplication app(argc, argv);
CfgFile cfile;
CfgParser cp;
- cp.load(QPEApplication::qpeDir()+"/share/zkb/zkb.xml", cfile);
+ cp.load(QPEApplication::qpeDir()+"share/zkb/zkb.xml", cfile);
CfgDlg c(0, &cfile, &app, true);
app.showMainWidget(&c);
int ret = QPEApplication::execDialog(&c);
return ret;
}
diff --git a/noncore/apps/opie-bartender/bartender.cpp b/noncore/apps/opie-bartender/bartender.cpp
index 59fc242..b4958b3 100644
--- a/noncore/apps/opie-bartender/bartender.cpp
+++ b/noncore/apps/opie-bartender/bartender.cpp
@@ -20,193 +20,193 @@
#include <opie2/odebug.h>
#include <qpe/qpeapplication.h>
#include <qpe/resource.h>
using namespace Opie::Core;
/* QT */
#include <qlineedit.h>
#include <qdir.h>
#include <qpushbutton.h>
#include <qlistbox.h>
#include <qmultilineedit.h>
#include <qmessagebox.h>
#include <qtextstream.h>
#include <qaction.h>
#include <qheader.h>
#include <qlistview.h>
#include <qlayout.h>
#include <qtoolbar.h>
#include <qmenubar.h>
/* STD */
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
Bartender::Bartender( QWidget* parent, const char* name, WFlags fl )
: QMainWindow( parent, name, fl ) {
if ( !name )
setName( "Bartender" );
QGridLayout *layout = new QGridLayout( this );
layout->setSpacing( 2);
layout->setMargin( 2);
connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
setCaption( tr( "Bartender" ) );
ToolBar1 = new QToolBar( this, "ToolBar1" );
ToolBar1->setFixedHeight(22);
layout->addMultiCellWidget( ToolBar1, 0, 0, 0, 4 );
QMenuBar *menuBar = new QMenuBar( ToolBar1 );
QPopupMenu *fileMenu;
fileMenu = new QPopupMenu( this);
menuBar->insertItem( tr("File"), fileMenu );
fileMenu->insertItem(tr("New Drink"));
fileMenu->insertItem(tr("Open Drink"));
fileMenu->insertItem(tr("Find by Drink Name"));
fileMenu->insertItem(tr("Find by Alcohol"));
QPopupMenu *editMenu;
editMenu = new QPopupMenu( this);
menuBar->insertItem( tr("Edit"), editMenu );
editMenu->insertItem(tr("edit"));
connect( fileMenu, SIGNAL( activated(int) ), this, SLOT( fileMenuActivated(int) ));
connect( editMenu, SIGNAL( activated(int) ), this, SLOT( editMenuActivated(int) ));
QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), "New", 0, this, 0 );
connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) );
a->addTo( ToolBar1 );
a = new QAction( tr( "Open" ), Resource::loadPixmap( "bartender/bartender_sm" ), "open", 0, this, 0 );
connect( a, SIGNAL( activated() ), this, SLOT( openCurrentDrink() ) );
a->addTo( ToolBar1 );
a = new QAction( tr( "Find" ), Resource::loadPixmap( "find" ), "Find", 0, this, 0 );
connect( a, SIGNAL( activated() ), this, SLOT( askSearch() ) );
a->addTo( ToolBar1 );
a = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ),"Edit", 0, this, 0 );
connect( a, SIGNAL( activated() ), this, SLOT( doEdit() ) );
a->addTo( ToolBar1 );
QPushButton *t;
t= new QPushButton( "BAC", ToolBar1, "bacButtin");
connect( t, SIGNAL( clicked() ), this, SLOT( doBac() ) );
DrinkView = new QListView( this, "DrinkView" );
DrinkView->addColumn( tr( "Name of Drink" ) );
// DrinkView->setRootIsDecorated( TRUE );
DrinkView->header()->hide();
QPEApplication::setStylusOperation( DrinkView->viewport(),QPEApplication::RightOnHold);
connect(DrinkView, SIGNAL( doubleClicked(QListViewItem*)),this,SLOT(showDrink(QListViewItem*)));
connect(DrinkView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)),
this,SLOT( showDrink(int,QListViewItem*,const QPoint&,int)));
layout->addMultiCellWidget( DrinkView, 1, 2, 0, 4 );
if(QDir("db").exists()) {
dbFile.setName( "db/drinkdb.txt");
} else
- dbFile.setName( QPEApplication::qpeDir()+"/etc/bartender/drinkdb.txt");
+ dbFile.setName( QPEApplication::qpeDir()+"etc/bartender/drinkdb.txt");
initDrinkDb();
}
Bartender::~Bartender() {
}
/*
this happens right before exit */
void Bartender::cleanUp() {
dbFile.close();
}
void Bartender::initDrinkDb() {
if(!dbFile.isOpen())
if ( !dbFile.open( IO_ReadOnly)) {
QMessageBox::message( (tr("Note")), (tr("Drink database not opened sucessfully.\n")) );
return;
}
fillList();
}
void Bartender::fillList() {
dbFile.at(1);
DrinkView->clear();
int i=0;
QListViewItem * item ;
QTextStream t( &dbFile);
QString s;
while ( !t.eof()) {
s = t.readLine();
if(s.find("#",0,TRUE) != -1) {
// odebug << s.right(s.length()-2) << oendl;
item= new QListViewItem( DrinkView, 0 );
item->setText( 0, s.right(s.length()-2));
i++;
}
}
odebug << "there are currently " << i << " of drinks" << oendl;
}
void Bartender::fileNew() {
New_Drink *newDrinks;
newDrinks = new New_Drink(this,"New Drink....", TRUE);
QString newName, newIng;
QPEApplication::execDialog( newDrinks );
newName = newDrinks->LineEdit1->text();
newIng= newDrinks->MultiLineEdit1->text();
if(dbFile.isOpen())
dbFile.close();
if ( !dbFile.open( IO_WriteOnly| IO_Append)) {
QMessageBox::message( (tr("Note")), (tr("Drink database not opened sucessfully.\n")) );
return;
}
if(newDrinks ->result() == 1 ) {
QString newDrink="\n# "+newName+"\n";
newDrink.append(newIng+"\n");
odebug << "writing "+newDrink << oendl;
dbFile.writeBlock( newDrink.latin1(), newDrink.length());
clearList();
dbFile.close();
initDrinkDb();
}
delete newDrinks;
}
void Bartender::showDrink(int mouse, QListViewItem * item, const QPoint&, int) {
switch (mouse) {
case 1:
// showDrink(item);
break;
case 2:
showDrink(item);
break;
}
}
void Bartender::showDrink( QListViewItem *item) {
if(item==NULL) return;
dbFile.at(0);
Show_Drink *showDrinks;
QString myDrink=item->text(0);
showDrinks = new Show_Drink(this, myDrink, TRUE);
QTextStream t( &dbFile);
QString s, s2;
while ( !t.eof()) {
s = t.readLine();
if(s.find( myDrink, 0, TRUE) != -1) {
for(int i=0;s2.find( "#", 0, TRUE) == -1;i++) {
s2 = t.readLine();
if(s2.find("#",0,TRUE) == -1 || dbFile.atEnd() ) {
diff --git a/noncore/apps/opie-console/fixit.cpp b/noncore/apps/opie-console/fixit.cpp
index 3b0044a..f170074 100644
--- a/noncore/apps/opie-console/fixit.cpp
+++ b/noncore/apps/opie-console/fixit.cpp
@@ -1,94 +1,94 @@
#include "fixit.h"
using namespace Opie::Core;
#ifdef FSCKED_DISTRI
FixIt::FixIt() {
/* the new inittab */
m_file = "#\n# /etc/inittab"
"#"
""
"# 0 - halt (Do NOT set initdefault to this)"
"# 1 - Single user mode"
"# 2 - Multiuser, without NFS (The same as 3, if you do not have networking)"
"# 3 - Full multiuser mode"
"# 4 - JavaVM(Intent) developer mode"
"# 5 - JavaVM(Intent)"
"# 6 - reboot (Do NOT set initdefault to this)"
"#"
"id:5:initdefault:"
""
"# Specify things to do when starting"
"si::sysinit:/etc/rc.d/rc.sysinit"
""
"l0:0:wait:/root/etc/rc.d/rc 0"
"l1:1:wait:/etc/rc.d/rc 1"
"l2:2:wait:/etc/rc.d/rc 2"
"l3:3:wait:/etc/rc.d/rc 3"
"l4:4:wait:/etc/rc.d/rc 4"
"l5:5:wait:/etc/rc.d/rc 5"
"l6:6:wait:/root/etc/rc.d/rc 6"
""
"# Specify things to do before rebooting"
"um::ctrlaltdel:/bin/umount -a -r > /dev/null 2>&1"
"sw::ctrlaltdel:/sbin/swapoff -a > /dev/null 2>&1"
""
"# Specify program to run on ttyS0"
"s0:24:respawn:/sbin/getty 9600 ttyS0"
"#pd:5:respawn:/etc/sync/serialctl"
""
"# Specify program to run on tty1"
"1:2:respawn:/sbin/getty 9600 tty1"
"ln:345:respawn:survive -l 6 /sbin/launch"
"#qt:5:respawn:/sbin/qt"
""
"# collie sp."
"sy::respawn:/sbin/shsync\n";
}
/*
* the retail Zaurus is broken in many ways
* one is that pppd is listening on our port...
* we've to stop it from that and then do kill(SIGHUP,1);
*/
void FixIt::fixIt() {
#ifndef EAST
- ::rename("/etc/inittab", QPEApplication::qpeDir() + "/etc/inittab" );
+ ::rename("/etc/inittab", QPEApplication::qpeDir() + "etc/inittab" );
QFile file( "/etc/inittab" );
if ( file.open(IO_WriteOnly | IO_Raw ) ) {
file.writeBlock(m_file,strlen(m_file) );
}
file.close();
::kill( SIGHUP, 1 );
#else
OProcess m_kill;
- m_kill << QPEApplication::qpeDir() + "/share/opie-console/sl6000_embedix_kill_0_1.sh";
+ m_kill << QPEApplication::qpeDir() + "share/opie-console/sl6000_embedix_kill_0_1.sh";
if ( !m_kill.start(OProcess::DontCare,OProcess::NoCommunication) ) {
owarn << "could not execute kill script" << oendl;
} else {
Global::statusMessage( QObject::tr("Fixing up Embedix"));
}
#endif
}
void FixIt::breakIt() {
#ifdef EAST
OProcess m_restart;
- m_restart << QPEApplication::qpeDir() + "/share/opie-console/sl6000_embedix_restart_0_1.sh";
+ m_restart << QPEApplication::qpeDir() + "share/opie-console/sl6000_embedix_restart_0_1.sh";
if ( !m_restart.start(OProcess::DontCare,OProcess::NoCommunication) ) {
owarn << "could not execute restart script" << oendl;
}
#endif
}
#endif
diff --git a/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp b/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp
index 020a116..3c096ed 100644
--- a/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp
+++ b/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp
@@ -1,153 +1,153 @@
/***************************************************************************
// LibraryDialog.cpp - description
// -------------------
// begin : Sat Aug 19 2000
// copyright : (C) 2000 - 2004 by llornkcor
// email : ljp@llornkcor.com
// ***************************************************/
// /***************************************************************************
// * This program is free software; you can redistribute it and/or modify *
// * it under the terms of the GNU General Public License as published by *
// * the Free Software Foundation; either version 2 of the License, or *
// * (at your option) any later version. *
// ***************************************************************************/
//ftp://ibiblio.org/pub/docs/books/gutenberg/GUTINDEX.ALL
#include "LibraryDialog.h"
#include "output.h"
/* OPIE */
#include <qpe/applnk.h>
#include <qpe/qpeapplication.h>
#include <qpe/qpedialog.h>
#include <opie2/odebug.h>
/* QT */
#include <qpushbutton.h>
#include <qmultilineedit.h>
//#include <qlayout.h>
/* STD */
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
/*
* The dialog will by default be modeless, unless you set 'modal' to
* TRUE to construct a modal dialog. */
LibraryDialog::LibraryDialog( QWidget* parent, const char* name , bool /*modal*/, WFlags fl )
: QDialog( parent, name, true/* modal*/, fl )
{
if ( !name )
setName( "LibraryDialog" );
indexLoaded=false;
initDialog();
// this->setMaximumWidth(240);
index = "GUTINDEX.ALL";
local_library = (QDir::homeDirPath ()) +"/Applications/gutenbrowser/";
local_index = local_library + index;
QString iniFile ;
- iniFile = QPEApplication::qpeDir()+"/etc/gutenbrowser/gutenbrowserrc";
+ iniFile = QPEApplication::qpeDir()+"etc/gutenbrowser/gutenbrowserrc";
- new_index =QPEApplication::qpeDir()+"/etc/gutenbrowser/PGWHOLE.TXT";
+ new_index =QPEApplication::qpeDir()+"etc/gutenbrowser/PGWHOLE.TXT";
- old_index = QPEApplication::qpeDir()+"/etc/gutenbrowser/GUTINDEX.ALL";
+ old_index = QPEApplication::qpeDir()+"etc/gutenbrowser/GUTINDEX.ALL";
// old_index = QPEApplication::qpeDir()+"etc/gutenbrowser/GUTINDEX.ALL";
// iniFile = local_library+"gutenbrowserrc";
// new_index = local_library + "PGWHOLE.TXT";
// old_index = local_library + "GUTINDEX.ALL";
Config config("Gutenbrowser");
config.setGroup( "HttpServer" );
proxy_http = config.readEntry("Preferred", "http://sailor.gutenbook.org");
config.setGroup( "FTPsite" );
ftp_host=config.readEntry("SiteName", "sailor.gutenberg.org");
odebug << "Library Dialog: ftp_host is "+ftp_host << oendl;
// ftp_host=ftp_host.right(ftp_host.length()-(ftp_host.find(") ",0,TRUE)+1) );
// ftp_host=ftp_host.stripWhiteSpace();
ftp_base_dir= config.readEntry("base", "/pub/gutenberg");
i_binary = 0;
config.setGroup("SortAuth");
if( config.readEntry("authSort", "FALSE") == "TRUE")
authBox->setChecked(TRUE);
config.setGroup("General");
downDir =config.readEntry( "DownloadDirectory",local_library);
odebug << "downDir is "+downDir << oendl;
newindexLib.setName( old_index);
indexLib.setName( old_index);
new QPEDialogListener(this);
QTimer::singleShot( 1000, this, SLOT( FindLibrary()) );
}
LibraryDialog::~LibraryDialog()
{
// delete QList_Item2;
// delete QList_Item1;
// delete QList_Item3;
// delete QList_Item4;
// delete QList_Item5;
// saveConfig();
}
/*This groks using PGWHOLE.TXT */
void LibraryDialog::Newlibrary()
{
#ifndef Q_WS_QWS //sorry embedded gutenbrowser cant use zip files
//odebug << "Opening new library index " << newindexLib << "" << oendl;
if ( newindexLib.open( IO_ReadOnly) ) {
setCaption( tr( "Library Index - using master pg index." ) );// file opened successfully
QTextStream indexStream( &newindexLib );
QString indexLine;
while ( !indexStream.atEnd() ) { // until end of file..
indexLine = indexStream.readLine();
if ( ( indexLine.mid(4,4)).toInt() && !( indexLine.left(3)).toInt()) {
year = indexLine.mid(4,4);
year = year.stripWhiteSpace();
file = indexLine.mid( indexLine.find( "[", 0, TRUE )+1, 12 );
file = file.stripWhiteSpace();
number = indexLine.mid( indexLine.find( "]", 0, TRUE ) +1, indexLine.find( " ", 0, TRUE )+1 );
if( year.toInt() < 1984)
number = number.left( number.length() -1 );
number = number.stripWhiteSpace();
title = indexLine.mid( indexLine.find(" ", 26, TRUE), indexLine.length() );
title = title.stripWhiteSpace();
getAuthor(); // groks author
author = author.stripWhiteSpace();
if (authBox->isChecked()) { // this reverses the first name and last name of the author
// odebug << "Sorting last name first" << oendl;
QString lastName, firstName="";
int finder=author.findRev( ' ', -1, TRUE);
lastName=author.right( author.length()-finder);
firstName=author.left(finder);
lastName=lastName.stripWhiteSpace();
firstName=firstName.stripWhiteSpace();
if( lastName.find( firstName, 0, true) == -1) // this avoids dup names
author=lastName+", "+firstName;
}
if( !number.isEmpty() && (title.find( "reserved",0, FALSE) == -1) && (file.find( "]",0, TRUE) == -1) ) {
// fill string list or something to be able to resort the whole library
if( author.isEmpty() )
QList_Item5 = new QListViewItem( ListView5, /* number,*/ title, author, year, file );
else {
if( (author.left(1) >= QString("A") && author.left(1) <= QString("F")) ||
(author.left(1) >= QString("a") && author.left(1) <= QString("f")) )
QList_Item1 = new QListViewItem( ListView1,/* number,*/ title, author, year, file );
else if( (author.left(1) >= QString("G") && author.left(1) <= QString("M")) ||
diff --git a/noncore/apps/opie-gutenbrowser/ftpsitedlg.cpp b/noncore/apps/opie-gutenbrowser/ftpsitedlg.cpp
index a9c7346..de9c72b 100644
--- a/noncore/apps/opie-gutenbrowser/ftpsitedlg.cpp
+++ b/noncore/apps/opie-gutenbrowser/ftpsitedlg.cpp
@@ -1,137 +1,137 @@
/***************************************************************************
ftpsitedlg.cpp - description
-------------------
begin : Tue Jul 25 2000
copyright : (C) 2000 -2004 by llornkcor
email : ljp@llornkcor.com
***************************************************************************/
/***************************************************************************
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
***************************************************************************/
#include "optionsDialog.h"
#include "gutenbrowser.h"
//#include "NetworkDialog.h"
#include "output.h"
/* OPIE */
#include <opie2/odebug.h>
#include <qpe/config.h>
/* QT */
#include <qprogressbar.h>
#include <qurloperator.h>
#include <qlistbox.h>
/* STD */
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
// :)~
void optionsDialog::ftpSiteDlg( )
{
//printf( "ftpSiteDlg: ListFile is "+ ListFile +"\n" );
// initDialog();
local_library = (QDir::homeDirPath ()) +"/Applications/gutenbrowser/";
// ListFile = local_library + "ftpList";
- ListFile = QPEApplication::qpeDir() + "/etc/gutenbrowser";
+ ListFile = QPEApplication::qpeDir() + "etc/gutenbrowser";
QDir dir(ListFile);
if( !dir.exists())
dir.mkdir(ListFile,true);
ListFile+="/ftpList";
odebug << "opening "+ListFile << oendl;
if ( QFile(ListFile).exists() ) {
openSiteList();
} else {
switch( QMessageBox::warning( this, "Gutenbrowser",
"Do you want to download \nan ftp site list?",
QMessageBox::Yes, QMessageBox::No)) {
case QMessageBox::Yes: // yes
getSite();
break;
case QMessageBox::No: // No
// exit
break;
}
}
}
/*
// get ftp list from web- parse it. */
void optionsDialog::getSite()
{
QString file_name;
QString ftp_listFileURL;
QString outputFile;
// outputFile = local_library+ "list.html";
outputFile = ListFile + "list.html";
QString networkUrl= "http://www.gutenberg.org/www/mirror.sites.html";
//http://www.gutenberg.org/index.html";
// QString networkUrl= "http://llornkcor.com/index.shtml";
// // "http://www.gutenberg.org/index.html"
//
//Qhttp stops working at times.... :(
// NetworkDialog *NetworkDlg;
// NetworkDlg = new NetworkDialog( this,"Network Protocol Dialog",TRUE,0,networkUrl,outputFile);
// if( NetworkDlg->exec() != 0 )
// { // use new, improved, *INSTANT* network-dialog-file-getterer
// odebug << "gitcha!" << oendl;
// }
// delete NetworkDlg;
//#ifdef Q_WS_QWS
// TODO qprocess here
QString cmd="wget -T 15 -O " +outputFile + " " + networkUrl + " 2>&1" ;
odebug << "Issuing the command "+cmd << oendl;
Output *outDlg;
outDlg = new Output( 0, tr("Downloading ftp sites...."),TRUE);
outDlg->showMaximized();
outDlg->show();
qApp->processEvents();
FILE *fp;
char line[130];
outDlg->OutputEdit->append( tr("Running wget") );
sleep(1);
fp = popen( (const char *) cmd, "r");
while ( fgets( line, sizeof line, fp)) {
outDlg->OutputEdit->append(line);
outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
}
pclose(fp);
outDlg->close();
if(outDlg)
delete outDlg;
// outputFile=ListFile;
ftp_QListBox_1->clear();
parseFtpList( outputFile); // got the html list, now parse it so we can use it
}
bool optionsDialog::parseFtpList( QString outputFile)
{
// parse ftplist html and extract just the machine names/directories
// TODO: add locations!!
odebug << "parse ftplist "+outputFile << oendl;
QString ftpList, s_location;
QFile f( outputFile );
if( f.open( IO_ReadWrite )) {
QTextStream t( &f);
QString countryName;
bool b_gotchTest=false;
while ( !t.eof() ) {
QString s = t.readLine();
int start;
int end;
if( s.find( "FTP mirror sites for Project Gutenberg:", 0, TRUE) !=-1) { //lower end of this file
b_gotchTest = true;
}
if( b_gotchTest) {
diff --git a/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp b/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp
index 644fae8..fac21da 100644
--- a/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp
+++ b/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp
@@ -49,198 +49,198 @@
#include <qobjectlist.h>
#include <qfontdialog.h>
#include <qtextview.h>
#include <qbrush.h>
#include <qfile.h>
#include <qfontinfo.h>
#include <qscrollview.h>
#include <qpoint.h>
/* STD */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
static const int nfontsizes = 9;
static const int fontsize[nfontsizes] = {8,9,10,11,12,13,14,18,24};
#ifdef NOQUICKLAUNCH
Gutenbrowser::Gutenbrowser()
Gutenbrowser();
#else
Gutenbrowser::Gutenbrowser(QWidget *,const char*, WFlags )
#endif
: QMainWindow()
{
// QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
// QCopEnvelope e("QPE/System", "grabKeyboard(QString)" );
// e << "";
// QPEApplication::grabKeyboard();
showMainList=TRUE;
working=false;
this->setUpdatesEnabled(TRUE);
// #ifndef Q_WS_QWS
QString msg;
msg="You have now entered unto gutenbrowser,\n";
msg+="make your self at home, sit back, relax and read something great.\n";
local_library = (QDir::homeDirPath ()) +"/Applications/gutenbrowser/";
setCaption("Gutenbrowser");// Embedded " VERSION);
this->setUpdatesEnabled(TRUE);
// bool firstTime=FALSE;
topLayout = new QVBoxLayout( this, 0, 0, "topLayout");
menu = new QHBoxLayout(-1,"menu");
buttons2 = new QHBoxLayout(-1,"buttons2");
edits = new QHBoxLayout(-1,"edits");
useSplitter=TRUE;
initConfig();
initMenuBar();
initButtonBar();
initStatusBar();
initView();
initSlots();
qDebug("init finished");
QPEApplication::setStylusOperation( mainList->viewport(),QPEApplication::RightOnHold);
connect( mainList, SIGNAL( mouseButtonPressed( int, QListBoxItem *, const QPoint &)),
this, SLOT( mainListPressed(int, QListBoxItem *, const QPoint &)) );
if( useIcons)
toggleButtonIcons( TRUE);
else
toggleButtonIcons( FALSE);
enableButtons(false);
Config config("Gutenbrowser"); // populate menubuttonlist
config.setGroup("General");
config.setGroup( "Files" );
QString s_numofFiles = config.readEntry("NumberOfFiles", "0" );
int i_numofFiles = s_numofFiles.toInt();
QString tempFileName;
for (int i = 0; i <= i_numofFiles; i++) {
// tempFileName.setNum(i);
config.setGroup( "Files" );
QString ramble = config.readEntry( QString::number(i), "" );
config.setGroup( "Titles" );
QString tempTitle = config.readEntry( ramble, "");
config.setGroup( tempTitle);
int index = config.readNumEntry( "LineNumber", -1 );
if( index != -1) {
odebug << tempTitle << oendl;
if(!tempTitle.isEmpty()) bookmarksMenu->insertItem( tempTitle);
}
}
// QString gutenIndex= local_library + "GUTINDEX.ALL";
- QString gutenIndex = QPEApplication::qpeDir()+ "/etc/gutenbrowser/GUTINDEX.ALL";
+ QString gutenIndex = QPEApplication::qpeDir()+ "etc/gutenbrowser/GUTINDEX.ALL";
qDebug("gutenindex "+gutenIndex );
if( QFile( gutenIndex).exists() ) {
indexLib.setName( gutenIndex);
} else {
- QString localLibIndexFile = QPEApplication::qpeDir()+ "/etc/gutenbrowser/PGWHOLE.TXT";
+ QString localLibIndexFile = QPEApplication::qpeDir()+ "etc/gutenbrowser/PGWHOLE.TXT";
// QString localLibIndexFile= local_library + "PGWHOLE.TXT";
newindexLib.setName( localLibIndexFile);
}
qDebug("attempting new library");
LibraryDlg = new LibraryDialog( this, "Library Index" /*, TRUE */);
loadCheck = false;
chdir(local_library);
if(!showMainList) {
Lview->setFocus();
// if(firstTime)
// Bookmark();
for (int i=1;i< qApp->argc();i++) {
qDebug("Suppose we open somethin");
if(!load(qApp->argv()[i])) return;
}
} else {
fillWithTitles();
mainList->setFocus();
// mainList->setCurrentItem(0);
}
writeConfig();
QTimer::singleShot( 250, this, SLOT(hideView()) );
} //end init
Gutenbrowser::~Gutenbrowser() {
// QPEApplication::grabKeyboard();
// QPEApplication::ungrabKeyboard();
odebug << "Exit" << oendl;
}
/*
Google.com search */
void Gutenbrowser::InfoBarClick() {
QString text;
if( Lview->hasSelectedText()) {
Lview->copy();
QClipboard *cb = QApplication::clipboard();
text = cb->text();
} else {
// text=title;
text=this->caption();
}
searchGoogle(text);
}
/*
download http with wget or preferred browser */
void Gutenbrowser::goGetit( const QString &url, bool showMsg) {
// int eexit=0;
QString cmd;
// config.read();
qApp->processEvents();
QString filename = QPEApplication::qpeDir();
if(filename.right(1)!="/")
filename+="/etc/gutenbrowser/";
else
filename+="etc/gutenbrowser/";
odebug << "filename "+filename << oendl;
// QString filename = QDir::homeDirPath()+"/Applications/gutenbrowser/";
filename += url.right( url.length() - url.findRev("/",-1,TRUE) -1);
Config config("Gutenbrowser");
config.setGroup( "Browser" );
QString brow = config.readEntry("Preferred", "Opera");
odebug << "Preferred browser is "+brow << oendl;
if(!showMsg) { //if we just get the gutenindex.all
cmd="wget -O " + filename +" " + url+" 2>&1" ;
chdir(local_library);
odebug << "Issuing the system command: " << cmd << "" << oendl;
Output *outDlg;
outDlg = new Output(this, tr("Gutenbrowser Output"),FALSE);
outDlg->showMaximized();
outDlg->show();
qApp->processEvents();
FILE *fp;
char line[130];
outDlg->OutputEdit->append( tr("Running wget") );
sleep(1);
fp = popen( (const char *) cmd, "r");
odebug << "Issuing the command\n"+cmd << oendl;
// system(cmd);
while ( fgets( line, sizeof line, fp)) {
outDlg->OutputEdit->append(line);
// outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
}
pclose(fp);
outDlg->close();
if(outDlg)
delete outDlg;
} else {
if( brow == "Konq") {
cmd = "konqueror "+url+" &";
}
diff --git a/noncore/apps/opie-gutenbrowser/helpme.cpp b/noncore/apps/opie-gutenbrowser/helpme.cpp
index 53e0236..0e23114 100644
--- a/noncore/apps/opie-gutenbrowser/helpme.cpp
+++ b/noncore/apps/opie-gutenbrowser/helpme.cpp
@@ -1,127 +1,127 @@
/***************************************************************************
helpme.cpp - description
-------------------
begin : Tue Jul 25 2000
begin : Sat Dec 4 1999
copyright : (C) 2000 -2004 by llornkcor
email : ljp@llornkcor.com
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "helpme.h"
#include "helpwindow.h"
/* OPIE */
#include <qpe/qcopenvelope_qws.h>
#include <qpe/qpeapplication.h>
#include <opie2/odebug.h>
/* QT */
#include <qprogressdialog.h>
#include <qlayout.h>
/* STD */
#include <sys/stat.h>
#include <unistd.h>
HelpMe::HelpMe(QWidget *parent, QString name ) : QDialog(parent,name)
{
local_library = ( QDir::homeDirPath ())+"/Applications/gutenbrowser/";
setCaption(tr("Gutenbrowser About " VERSION));
QGridLayout *layout = new QGridLayout( this );
layout->setSpacing( 4 );
layout->setMargin( 4 );
Edit = new QMultiLineEdit(this, "");
Edit->setReadOnly(true);
Edit->append(tr("Based on gutenbook.pl, available from http://www.gutenbook.org"));
Edit->append(tr("Much appreciation to Lee Burgess,"));
Edit->append(tr("for the original idea and concept of gutenbook.\n"));
Edit->append(tr("A list of current Gutenberg ftp sites is at http://promo.net/pg/index.html\n"));
Edit->append(tr("For bug reports, comments or questions about Gutenbrowser, email"));
Edit->append(tr("ljp@llornkcor.com\n"));
Edit->append(tr("\nMade using Qt, Qt Embedded, and Qtopia, a cross platform development API\nhttp://www.trolltech.com\n\n"));
Edit->append(tr("Arnold's Laws of Documentation:"));
Edit->append(tr("(1) If it should exist, it doesn't."));
Edit->append(tr("(2) If it does exist, it's out of date."));
Edit->append(tr("(3) Only documentation for"));
Edit->append(tr("useless programs transcends the"));
Edit->append(tr("first two laws.\n"));
Edit->append(tr("Everything is temporary, anyway....\n :o)"));
Edit->setWordWrap(QMultiLineEdit::WidgetWidth);
QString pixDir;
- pixDir=QPEApplication::qpeDir()+"/pics/";
+ pixDir=QPEApplication::qpeDir()+"pics/";
QPushButton *help;
help = new QPushButton(this);
help->setPixmap( QPixmap( pixDir+"gutenbrowser/help.png"));
help->setText("Help");
connect( help,SIGNAL(clicked()),this,SLOT( help() ));
/* QPushButton *ok;
ok = new QPushButton(this);
ok->setPixmap( QPixmap( pixDir+"/gutenbrowser/exit.png"));
ok->setText("ok");
connect(ok,SIGNAL(clicked()),this,SLOT(accept() ));
*/
help->setFixedHeight(25);
// ok->setFixedHeight(25);
// layout->addMultiCellWidget( ok, 0, 0, 4, 4 );
layout->addMultiCellWidget( help, 0, 0, 4, 4 );
layout->addMultiCellWidget( Edit, 1, 1, 0, 4 );
}
HelpMe::~HelpMe()
{
//delete Edit;
}
void HelpMe::goToURL()
{
url = "http://www.llornkcor.com/";
goGetit( url);
}
void HelpMe::goToURL2()
{
url = "http://www.gutenberg.org";
goGetit( url);
}
void HelpMe::goToURL3()
{
url = "http://www.gutenbook.org";
goGetit( url);
}
void HelpMe::goGetit( QString url)
{
HelpWindow *help = new HelpWindow( url, ".", 0, "gutenbrowser");
help->setCaption("Qt Example - Helpviewer");
help->showMaximized();
help->show();
}
void HelpMe::help()
{
QString msg ;
msg=QPEApplication::qpeDir()+"help/html/gutenbrowser-index.html"; // or where ever this ends up to be
odebug << msg << oendl;
QString url = "file://"+msg;
goGetit( url);
// QCopEnvelope e("QPE/Application/helpbrowser", "setDocument(QString)" );
// e << msg;
// goGetit( msg);
}
diff --git a/noncore/apps/zsafe/zsafe.cpp b/noncore/apps/zsafe/zsafe.cpp
index 6aa6392..1ae3b15 100644
--- a/noncore/apps/zsafe/zsafe.cpp
+++ b/noncore/apps/zsafe/zsafe.cpp
@@ -2683,656 +2683,656 @@ void ZSafe::addCategory()
else
{
categoryDialog = new CategoryDialog(this, tr("Category"), TRUE);
#ifdef Q_WS_WIN
categoryDialog->setCaption ("Qt " + tr("Category"));
#endif
dialog = categoryDialog;
connect( dialog->CategoryField,
SIGNAL( activated(const QString&)),
this, SLOT( categoryFieldActivated(const QString&) ) );
initIcons = true;
}
#ifdef DESKTOP
#ifndef Q_WS_WIN
QStringList list = conf->entryList( APP_KEY+"/fieldDefs" );
#else
// read all categories from the config file and store
// into a list
QFile f (cfgFile);
QStringList list;
if ( f.open(IO_ReadOnly) ) { // file opened successfully
QTextStream t( &f ); // use a text stream
QString s;
int n = 1;
while ( !t.eof() ) { // until end of file...
s = t.readLine(); // line of text excluding '\n'
list.append(s);
}
f.close();
}
#endif
#else
// read all categories from the config file and store
// into a list
QFile f (cfgFile);
QStringList list;
if ( f.open(IO_ReadOnly) ) { // file opened successfully
QTextStream t( &f ); // use a text stream
QString s;
while ( !t.eof() ) { // until end of file...
s = t.readLine(); // line of text excluding '\n'
list.append(s);
}
f.close();
}
#endif
QStringList::Iterator it = list.begin();
QString categ;
QString firstCategory;
dialog->CategoryField->clear(); // remove all items
while( it != list.end() )
{
QString *cat = new QString (*it);
if (cat->contains("-field1", FALSE))
{
#ifdef DESKTOP
#ifndef Q_WS_WIN
categ = cat->section ("-field1", 0, 0);
#else
int pos = cat->find ("-field1");
categ = cat->left (pos);
#endif
#else
int pos = cat->find ("-field1");
cat->truncate(pos);
categ = *cat;
#endif
if (!categ.isEmpty())
{
dialog->CategoryField->insertItem (categ, -1);
if (firstCategory.isEmpty())
firstCategory = categ;
}
}
++it;
}
if (firstCategory.isEmpty())
setCategoryDialogFields(dialog);
else
setCategoryDialogFields(dialog, firstCategory);
// CategoryDialog *dialog = new CategoryDialog(this, "Category", TRUE);
if (initIcons)
{
Wait waitDialog(this, tr("Wait dialog"));
waitDialog.waitLabel->setText(tr("Gathering icons..."));
waitDialog.show();
qApp->processEvents();
#ifdef DESKTOP
QDir d(iconPath);
#else
- QDir d(QPEApplication::qpeDir() + "/pics/");
+ QDir d(QPEApplication::qpeDir() + "pics/");
#endif
d.setFilter( QDir::Files);
const QFileInfoList *list = d.entryInfoList();
QFileInfoListIterator it( *list ); // create list iterator
QFileInfo *fi; // pointer for traversing
dialog->IconField->insertItem("predefined");
while ( (fi=it.current()) ) { // for each file...
QString fileName = fi->fileName();
if(fileName.right(4) == ".png"){
fileName = fileName.mid(0,fileName.length()-4);
#ifdef DESKTOP
QPixmap imageOfFile;
imageOfFile.load(iconPath + fi->fileName());
#else
QPixmap imageOfFile(Resource::loadPixmap(fileName));
#endif
QImage foo = imageOfFile.convertToImage();
foo = foo.smoothScale(16,16);
imageOfFile.convertFromImage(foo);
dialog->IconField->insertItem(imageOfFile,fileName);
}
++it;
}
waitDialog.hide();
}
#ifndef Q_WS_WIN
dialog->show();
#endif
#ifndef DESKTOP
// dialog->move (20, 100);
#endif
DialogCode result = (DialogCode) dialog->exec();
#ifdef DESKTOP
result = Accepted;
#endif
QString category;
QString icon;
QString fullIconPath;
QPixmap *pix;
if (result == Accepted)
{
modified = true;
category = dialog->CategoryField->currentText();
icon = dialog->IconField->currentText()+".png";
#ifndef NO_OPIE
owarn << category << oendl;
#endif
QListViewItem *li = new ShadedListItem( 1, ListView );
Category *c1 = new Category();
c1->setCategoryName(category);
// if (!icon.isEmpty() && !icon.isNull())
if (icon != "predefined.png")
{
// build the full path
fullIconPath = iconPath + icon;
pix = new QPixmap (fullIconPath);
// pix->resize(14, 14);
if (!pix->isNull())
{
// save the full pixmap name into the config file
// #ifndef Q_WS_WIN
conf->writeEntry(APP_KEY+category, icon);
// #endif
saveConf();
QImage img = pix->convertToImage();
pix->convertFromImage(img.smoothScale(14,14));
c1->setIcon (*pix);
c1->setIconName(icon);
}
else
{
QPixmap folder( ( const char** ) general_data );
c1->setIcon (folder);
}
}
else
{
c1->setIcon (*getPredefinedIcon(category));
}
c1->setListItem (li);
c1->initListItem();
categories.insert (c1->getCategoryName(), c1);
saveCategoryDialogFields(dialog);
}
else
{
// delete dialog;
dialog->hide();
return;
}
}
}
void ZSafe::delCategory()
{
if (!selectedItem)
return;
if (isCategory(selectedItem))
{
switch( QMessageBox::information( this, tr("ZSafe"),
tr("Do you want to delete?"),
tr("&Delete"), tr("D&on't Delete"),
0 // Enter == button 0
) ) { // Escape == button 2
case 0: // Delete clicked, Alt-S or Enter pressed.
// Delete from the category list
modified = true;
categories.remove (selectedItem->text(0));
// #ifndef Q_WS_WIN
conf->removeEntry (selectedItem->text(0));
// #endif
saveConf();
// Delete the selected item and all subitems
// step through all subitems
QListViewItem *si;
for (si = selectedItem->firstChild();
si != NULL; )
{
QListViewItem *_si = si;
si = si->nextSibling();
selectedItem->takeItem(_si); // remove from view list
if (_si) delete _si;
}
ListView->takeItem(selectedItem);
delete selectedItem;
selectedItem = NULL;
break;
case 1: // Don't delete
break;
}
}
}
void ZSafe::setCategoryDialogFields(CategoryDialog *dialog)
{
if (!dialog)
return;
QString icon;
if (selectedItem)
{
dialog->Field1->setText(getFieldLabel (selectedItem, "1", tr("Name")));
dialog->Field2->setText(getFieldLabel (selectedItem, "2", tr("Username")));
dialog->Field3->setText(getFieldLabel (selectedItem, "3", tr("Password")));
dialog->Field4->setText(getFieldLabel (selectedItem, "4", tr("Comment")));
dialog->Field5->setText(getFieldLabel (selectedItem, "5", tr("Field 4")));
dialog->Field6->setText(getFieldLabel (selectedItem, "6", tr("Field 5")));
Category *cat= categories.find (selectedItem->text(0));
if (cat)
{
icon = cat->getIconName();
}
else
icon = conf->readEntry(APP_KEY+selectedItem->text(0));
}
else
{
dialog->Field1->setText(tr("Name"));
dialog->Field2->setText(tr("Username"));
dialog->Field3->setText(tr("Password"));
dialog->Field4->setText(tr("Comment"));
dialog->Field5->setText(tr("Field 4"));
dialog->Field6->setText(tr("Field 5"));
}
#ifdef DESKTOP
QDir d(iconPath);
#else
- QDir d(QPEApplication::qpeDir() + "/pics/");
+ QDir d(QPEApplication::qpeDir() + "pics/");
#endif
d.setFilter( QDir::Files);
const QFileInfoList *list = d.entryInfoList();
int i=0;
QFileInfoListIterator it( *list ); // create list iterator
QFileInfo *fi; // pointer for traversing
if (icon.isEmpty() || icon.isNull())
{
dialog->IconField->setCurrentItem(0);
}
else
{
while ( (fi=it.current()) )
{ // for each file...
QString fileName = fi->fileName();
if(fileName.right(4) == ".png")
{
fileName = fileName.mid(0,fileName.length()-4);
if(fileName+".png"==icon)
{
dialog->IconField->setCurrentItem(i+1);
break;
}
++i;
}
++it;
}
}
}
void ZSafe::setCategoryDialogFields(CategoryDialog *dialog, QString category)
{
if (!dialog)
return;
dialog->Field1->setText(getFieldLabel (category, "1", tr("Name")));
dialog->Field2->setText(getFieldLabel (category, "2", tr("Username")));
dialog->Field3->setText(getFieldLabel (category, "3", tr("Password")));
dialog->Field4->setText(getFieldLabel (category, "4", tr("Comment")));
dialog->Field5->setText(getFieldLabel (category, "5", tr("Field 4")));
dialog->Field6->setText(getFieldLabel (category, "6", tr("Field 5")));
QString icon;
Category *cat= categories.find (category);
if (cat)
{
icon = cat->getIconName();
}
else
icon = conf->readEntry(APP_KEY+category);
#ifdef DESKTOP
QDir d(iconPath);
#else
- QDir d(QPEApplication::qpeDir() + "/pics/");
+ QDir d(QPEApplication::qpeDir() + "pics/");
#endif
d.setFilter( QDir::Files);
const QFileInfoList *list = d.entryInfoList();
int i=0;
QFileInfoListIterator it( *list ); // create list iterator
QFileInfo *fi; // pointer for traversing
if (icon.isEmpty() || icon.isNull())
{
dialog->IconField->setCurrentItem(0);
}
else
{
while ( (fi=it.current()) )
{ // for each file...
QString fileName = fi->fileName();
if(fileName.right(4) == ".png")
{
fileName = fileName.mid(0,fileName.length()-4);
if(fileName+".png"==icon)
{
dialog->IconField->setCurrentItem(i+1);
break;
}
++i;
}
++it;
}
}
}
void ZSafe::saveCategoryDialogFields(CategoryDialog *dialog)
{
QString app_key = APP_KEY;
#ifndef DESKTOP
conf->setGroup ("fieldDefs");
#else
#ifndef Q_WS_WIN
app_key += "/fieldDefs/";
#endif
#endif
QString category = dialog->CategoryField->currentText();
// #ifndef Q_WS_WIN
conf->writeEntry(app_key+category+"-field1", dialog->Field1->text());
conf->writeEntry(app_key+category+"-field2", dialog->Field2->text());
conf->writeEntry(app_key+category+"-field3", dialog->Field3->text());
conf->writeEntry(app_key+category+"-field4", dialog->Field4->text());
conf->writeEntry(app_key+category+"-field5", dialog->Field5->text());
conf->writeEntry(app_key+category+"-field6", dialog->Field6->text());
// #endif
saveConf();
#ifndef DESKTOP
conf->setGroup ("zsafe");
#endif
}
void ZSafe::editCategory()
{
if (!selectedItem)
return;
if (isCategory(selectedItem))
{
QString category = selectedItem->text(0);
bool initIcons = false;
// open the 'Category' dialog
CategoryDialog *dialog;
if (categoryDialog)
{
dialog = categoryDialog;
}
else
{
categoryDialog = new CategoryDialog(this, tr("Category"), TRUE);
#ifdef Q_WS_WIN
categoryDialog->setCaption ("Qt " + tr("Category"));
#endif
dialog = categoryDialog;
connect( dialog->CategoryField,
SIGNAL( activated(const QString&)),
this, SLOT( categoryFieldActivated(const QString&) ) );
initIcons = true;
}
setCategoryDialogFields(dialog);
#ifdef DESKTOP
#ifndef Q_WS_WIN
QStringList list = conf->entryList( APP_KEY+"/fieldDefs" );
#else
// read all categories from the config file and store
// into a list
QFile f (cfgFile);
QStringList list;
if ( f.open(IO_ReadOnly) ) { // file opened successfully
QTextStream t( &f ); // use a text stream
QString s;
int n = 1;
while ( !t.eof() ) { // until end of file...
s = t.readLine(); // line of text excluding '\n'
list.append(s);
}
f.close();
}
#endif
#else
// read all categories from the config file and store
// into a list
QFile f (cfgFile);
QStringList list;
if ( f.open(IO_ReadOnly) ) { // file opened successfully
QTextStream t( &f ); // use a text stream
QString s;
while ( !t.eof() ) { // until end of file...
s = t.readLine(); // line of text excluding '\n'
list.append(s);
}
f.close();
}
#endif
QStringList::Iterator it = list.begin();
QString categ;
dialog->CategoryField->clear(); // remove all items
int i=0;
bool foundCategory = false;
while( it != list.end() )
{
QString *cat = new QString (*it);
if (cat->contains("-field1", FALSE))
{
#ifdef DESKTOP
#ifndef Q_WS_WIN
categ = cat->section ("-field1", 0, 0);
#else
int pos = cat->find ("-field1");
categ = cat->left (pos);
#endif
#else
int pos = cat->find ("-field1");
cat->truncate(pos);
categ = *cat;
#endif
if (!categ.isEmpty())
{
dialog->CategoryField->insertItem (categ, i);
if (category.compare(categ) == 0)
{
dialog->CategoryField->setCurrentItem(i);
foundCategory = true;
}
i++;
}
}
++it;
}
if (!foundCategory)
{
dialog->CategoryField->insertItem (category, i);
dialog->CategoryField->setCurrentItem(i);
}
QString icon;
Category *cat= categories.find (selectedItem->text(0));
if (cat)
{
icon = cat->getIconName();
}
if (initIcons)
{
Wait waitDialog(this, tr("Wait dialog"));
waitDialog.waitLabel->setText(tr("Gathering icons..."));
waitDialog.show();
qApp->processEvents();
#ifdef DESKTOP
QDir d(iconPath);
#else
- QDir d(QPEApplication::qpeDir() + "/pics/");
+ QDir d(QPEApplication::qpeDir() + "pics/");
#endif
d.setFilter( QDir::Files);
const QFileInfoList *list = d.entryInfoList();
int i=0;
QFileInfoListIterator it( *list ); // create list iterator
QFileInfo *fi; // pointer for traversing
if (icon.isEmpty() || icon.isNull())
{
dialog->IconField->setCurrentItem(0);
}
dialog->IconField->insertItem("predefined");
while ( (fi=it.current()) ) { // for each file...
QString fileName = fi->fileName();
if(fileName.right(4) == ".png")
{
fileName = fileName.mid(0,fileName.length()-4);
#ifdef DESKTOP
QPixmap imageOfFile;
imageOfFile.load(iconPath + fi->fileName());
#else
QPixmap imageOfFile(Resource::loadPixmap(fileName));
#endif
QImage foo = imageOfFile.convertToImage();
foo = foo.smoothScale(16,16);
imageOfFile.convertFromImage(foo);
dialog->IconField->insertItem(imageOfFile,fileName);
if(fileName+".png"==icon)
dialog->IconField->setCurrentItem(i+1);
++i;
}
++it;
}
waitDialog.hide();
}
else
{
#ifdef DESKTOP
// QDir d(QDir::homeDirPath() + "/pics/");
QDir d(iconPath);
#else
- QDir d(QPEApplication::qpeDir() + "/pics/");
+ QDir d(QPEApplication::qpeDir() + "pics/");
#endif
d.setFilter( QDir::Files);
const QFileInfoList *list = d.entryInfoList();
int i=0;
QFileInfoListIterator it( *list ); // create list iterator
QFileInfo *fi; // pointer for traversing
if (icon.isEmpty() || icon.isNull())
{
dialog->IconField->setCurrentItem(0);
}
else
{
while ( (fi=it.current()) )
{ // for each file...
QString fileName = fi->fileName();
if(fileName.right(4) == ".png")
{
fileName = fileName.mid(0,fileName.length()-4);
if(fileName+".png"==icon)
{
dialog->IconField->setCurrentItem(i+1);
break;
}
++i;
}
++it;
}
}
}
// dialog->show();
#ifndef DESKTOP
// dialog->move (20, 100);
#endif
DialogCode result = (DialogCode) dialog->exec();
#ifdef DESKTOP
result = Accepted;
#endif
QString fullIconPath;
QPixmap *pix;
if (result == Accepted)
{
modified = true;
if (category != dialog->CategoryField->currentText())
{
categories.remove (category);
// #ifndef Q_WS_WIN
conf->removeEntry(category);
// #endif
saveConf();
}
category = dialog->CategoryField->currentText();
icon = dialog->IconField->currentText()+".png";
if (cat)
{
#ifndef NO_OPIE
owarn << "Category found" << oendl;
#else
qWarning("Category found");
#endif
// if (!icon.isEmpty() && !icon.isNull())
if (icon != "predefined.png")
{
// build the full path
fullIconPath = iconPath + icon;
pix = new QPixmap (fullIconPath);
if (!pix->isNull())
{
// save the full pixmap name into the config file
// #ifndef Q_WS_WIN
conf->writeEntry(APP_KEY+category, icon);
// #endif
saveConf();
QImage img = pix->convertToImage();
pix->convertFromImage(img.smoothScale(14,14));
cat->setIconName (icon);
cat->setIcon (*pix);
}
}
else
{
// #ifndef Q_WS_WIN
conf->removeEntry (category);
// #endif
saveConf();
cat->setIcon (*getPredefinedIcon(category));
}
diff --git a/noncore/games/backgammon/backgammon.cpp b/noncore/games/backgammon/backgammon.cpp
index bdb1c78..c286a36 100644
--- a/noncore/games/backgammon/backgammon.cpp
+++ b/noncore/games/backgammon/backgammon.cpp
@@ -1,156 +1,156 @@
#include "backgammon.h"
#include "aidialog.h"
#include "filedialog.h"
#include "playerdialog.h"
#include "rulesdialog.h"
#include "themedialog.h"
/* OPIE */
#include <opie2/odebug.h>
#include <qpe/qpeapplication.h>
#include <qpe/config.h>
#include <qpe/resource.h>
using namespace Opie::Core;
/* QT */
#include <qfile.h>
#include <qlayout.h>
#include <qmessagebox.h>
#include <qtimer.h>
#include <qmenubar.h>
#include <stdlib.h>
BackGammon::BackGammon(QWidget* parent, const char* name, WFlags fl)
: QMainWindow(parent, name, fl)
{
if (!name) setName("BackGammon");
setCaption(tr( "Backgammon") );
setIcon( Resource::loadPixmap( "backgammon" ) );
//general counter varaible
int a=0;
//the game engine
move=new MoveEngine();
//load the default theme
Config conf("backgammon");
if(!conf.isValid())
{
odebug << "config file does not exist" << oendl;
conf.setGroup("general");
conf.writeEntry("theme","default");
conf.setGroup("rules");
conf.writeEntry("move_with_pieces_out",false);
conf.writeEntry("nice_dice",false);
conf.setGroup("display");
conf.writeEntry("small",false);
conf.writeEntry("warning",true);
conf.setGroup("ai");
conf.writeEntry("rescue",6);
conf.writeEntry("eliminate",4);
conf.writeEntry("expose",1);
conf.writeEntry("protect",5);
conf.writeEntry("safe",3);
conf.writeEntry("empty",2);
}
conf.setGroup("general");
theme_name=conf.readEntry("theme","default");
- QString theme_file=QPEApplication::qpeDir()+"/backgammon/"+theme_name+".theme";
+ QString theme_file=QPEApplication::qpeDir()+"backgammon/"+theme_name+".theme";
//the rules
conf.setGroup("rules");
rules.move_with_pieces_out=conf.readBoolEntry("move_with_pieces_out",false);
rules.generous_dice=conf.readBoolEntry("nice_dice",false);
move->setRules(rules);
//get the AI settings
AISettings ai;
conf.setGroup("ai");
ai.rescue=conf.readNumEntry("rescue",6);
ai.eliminate=conf.readNumEntry("eliminate",4);
ai.expose=conf.readNumEntry("expose",1);
ai.protect=conf.readNumEntry("protect",5);
ai.safe=conf.readNumEntry("safe",3);
ai.empty=conf.readNumEntry("empty",2);
move->setAISettings(ai);
//get the theme component names
Config theme(theme_file,Config::File);
if(!theme.isValid())
{
odebug << "theme file does not exist" << oendl;
theme.setGroup("theme");
theme.writeEntry("board","casino_board_1");
theme.writeEntry("pieces1","casino_pieces_blue");
theme.writeEntry("pieces2","casino_pieces_white");
theme.writeEntry("dice1","casino_dice");
theme.writeEntry("dice2","casino_dice");
theme.writeEntry("table","casino_table_green");
theme.writeEntry("odds","casino_odds");
}
theme.setGroup("theme");
board_name=theme.readEntry("board","casino_board_1");
piecesA_name=theme.readEntry("pieces1","casino_pieces_blue");
piecesB_name=theme.readEntry("pieces2","casino_pieces_white");
diceA_name=theme.readEntry("dice1","casino_dice");
diceB_name=theme.readEntry("dice2","casino_dice");
table_name=theme.readEntry("table","casino_table_green");
odds_name=theme.readEntry("odds","casino_odds");
//the menu
QMenuBar* menuBar = new QMenuBar(this);
QPopupMenu* gamemenu= new QPopupMenu(this);
gamemenu->insertItem(tr( "New" ),this,SLOT(newgame()));
gamemenu->insertSeparator();
gamemenu->insertItem(tr( "Load" ),this,SLOT(loadgame()));
gamemenu->insertItem(tr( "Save" ),this,SLOT(savegame()));
gamemenu->insertSeparator();
gamemenu->insertItem(tr( "Delete" ),this,SLOT(deletegame()));
menuBar->insertItem(tr( "Game" ),gamemenu);
QPopupMenu* thememenu= new QPopupMenu(this);
thememenu->insertItem(tr( "New" ),this,SLOT(newtheme()));
thememenu->insertSeparator();
thememenu->insertItem(tr( "Load"),this,SLOT(loadtheme()));
thememenu->insertItem(tr( "Save" ),this,SLOT(savetheme()));
thememenu->insertSeparator();
thememenu->insertItem(tr( "Default"),this,SLOT(themedefault()));
thememenu->insertItem(tr( "Delete" ),this,SLOT(deletetheme()));
menuBar->insertItem(tr( "Theme" ),thememenu);
QPopupMenu* optionmenu=new QPopupMenu(this);
optionmenu->insertItem(tr( "Player" ),this,SLOT(playerselect()));
optionmenu->insertSeparator();
optionmenu->insertItem(tr( "AI" ),this,SLOT(modify_AI()));
optionmenu->insertItem(tr( "Rules" ),this,SLOT(setrules()));
menuBar->insertItem(tr( "Options"),optionmenu);
QWidget* mainarea=new QWidget(this);
setCentralWidget(mainarea);
//the main area
QBoxLayout* layout=new QBoxLayout(mainarea,QBoxLayout::TopToBottom);
area=new QCanvas(235,235);
boardview=new BackGammonView(area,mainarea);
boardview->setMaximumHeight(240);
layout->addWidget(boardview);
connect(boardview,SIGNAL(mouse(int,int)),this,SLOT(mouse(int,int)));
//status bar
message=new QLabel("<b>Backgammon</b>",mainarea);
message->setAlignment(AlignHCenter);
layout->addWidget(message);
//the marker
marker_current=new QCanvasRectangle(area);
marker_current->setBrush(QColor(0,0,255));
marker_current->setSize(15,5);
marker_current->setZ(1);
for(a=0;a<4;a++)
{
marker_next[a]=new QCanvasRectangle(area);
@@ -235,374 +235,374 @@ BackGammon::BackGammon(QWidget* parent, const char* name, WFlags fl)
if(a<6)
{
QImage oddsbg=oddsbg_all.copy(a*15,0,15,15);
oddsDice[a]=new CanvasImageItem(oddsbg,area);
oddsDice[a]->setX(110);
oddsDice[a]->setY(210-2);
oddsDice[a]->setZ(1);
oddsDice[a]->setSize(15,15);
oddsDice[a]->hide();
}
*/
}
//oddsDice[0]->show();
//set the board
QImage boardbg(Resource::loadImage("backgammon/boards/"+board_name));
board=new CanvasImageItem(boardbg,area);
board->setX(0);
board->setY(0);
board->setZ(0);
board->setSize(235-2,200-2);
board->show();
//the table
QImage tablebg(Resource::loadImage("backgammon/table/"+table_name));
table=new CanvasImageItem(tablebg,area);
table->setX(0);
table->setY(200-2);
table->setZ(0);
table->setSize(235-2,20);
table->show();
//the no move marker
QImage nomovebg(Resource::loadImage("backgammon/no_move"));
nomove_marker=new CanvasImageItem(nomovebg,area);
nomove_marker->setX(0);
nomove_marker->setY(200);
nomove_marker->setZ(2);
nomove_marker->hide();
//default human against computer
player1_auto=false;
player2_auto=true;
//start new game
newgame();
}
BackGammon::~BackGammon()
{
//DESTRUCTOR
}
void BackGammon::newgame()
{
gameFinished=false;
QDateTime now=QDateTime::currentDateTime();
game_name=now.date().toString()+"_"+now.time().toString();
move->reset();
draw();
diceA1_value=7;
diceA2_value=7;
diceA3_value=7;
diceA4_value=7;
diceB1_value=7;
diceB2_value=7;
diceB3_value=7;
diceB4_value=7;
showdice();
player=2;
dice1_played=true;
dice2_played=true;
dice3_played=true;
dice4_played=true;
dice_rolled=false;
setplayer();
area->update();
}
void BackGammon::playerselect()
{
PlayerDialog* playerdialog=new PlayerDialog(this);
playerdialog->setAuto1(player1_auto);
playerdialog->setAuto2(player2_auto);
if(!playerdialog->exec())
return;
player1_auto=playerdialog->getAuto1();
player2_auto=playerdialog->getAuto2();
}
void BackGammon::loadgame()
{
FileDialog* file=new FileDialog(this,"Load Game",".game");
if(!file->exec())
return;
game_name=file->filename();
- QString game_file=QPEApplication::qpeDir()+"/backgammon/"+game_name+".game";
+ QString game_file=QPEApplication::qpeDir()+"backgammon/"+game_name+".game";
Config game(game_file,Config::File);
game.setGroup("dice");
diceA1_value=game.readNumEntry("diceA1_value");
diceA2_value=game.readNumEntry("diceA2_value");
diceA3_value=game.readNumEntry("diceA3_value");
diceA4_value=game.readNumEntry("diceA4_value");
diceB1_value=game.readNumEntry("diceB1_value");
diceB2_value=game.readNumEntry("diceB2_value");
diceB3_value=game.readNumEntry("diceB3_value");
diceB4_value=game.readNumEntry("diceB4_value");
player=game.readNumEntry("player");
dice1_played=game.readBoolEntry("dice1_played");
dice2_played=game.readBoolEntry("dice2_played");
dice3_played=game.readBoolEntry("dice3_played");
dice4_played=game.readBoolEntry("dice4_played");
dice_rolled=game.readBoolEntry("dice_rolled");
player1_auto=game.readBoolEntry("player1_auto");
player2_auto=game.readBoolEntry("player2_auto");
game.setGroup("pieces");
QString label;
LoadSave load;
for(int a=0;a<28;a++)
{
label.setNum(a);
load.pop[a].total = game.readNumEntry(label,0);
}
move->loadGame(load);
setplayer();
showdice();
draw();
area->update();
}
void BackGammon::savegame()
{
- QString game_file=QPEApplication::qpeDir()+"/backgammon/"+game_name+".game";
+ QString game_file=QPEApplication::qpeDir()+"backgammon/"+game_name+".game";
Config game(game_file,Config::File);
game.setGroup("dice");
game.writeEntry("diceA1_value",diceA1_value);
game.writeEntry("diceA2_value",diceA2_value);
game.writeEntry("diceA3_value",diceA3_value);
game.writeEntry("diceA4_value",diceA4_value);
game.writeEntry("diceB1_value",diceB1_value);
game.writeEntry("diceB2_value",diceB3_value);
game.writeEntry("diceB3_value",diceB4_value);
game.writeEntry("diceB4_value",diceB4_value);
game.writeEntry("player",player);
game.writeEntry("dice1_played",dice1_played);
game.writeEntry("dice2_played",dice2_played);
game.writeEntry("dice3_played",dice3_played);
game.writeEntry("dice4_played",dice4_played);
game.writeEntry("dice_rolled",dice_rolled);
game.writeEntry("player1_auto",player1_auto);
game.writeEntry("player2_auto",player2_auto);
game.setGroup("pieces");
QString label;
LoadSave save=move->saveGame();
for(int a=0;a<28;a++)
{
label.setNum(a);
game.writeEntry(label,save.pop[a].total);
}
QMessageBox::information(this,"Backgammon","Game saved","OK");
}
void BackGammon::deletegame()
{
FileDialog* file=new FileDialog(this,"Delete Game",".game");
if(!file->exec())
return;
game_name=file->filename();
- QString game_file=QPEApplication::qpeDir()+"/backgammon/"+game_name+".game";
+ QString game_file=QPEApplication::qpeDir()+"backgammon/"+game_name+".game";
if(!QMessageBox::warning(this,"Backgammon","deleted game\n"+game_name+" ?","OK","Cancel"))
{
QFile(game_file).remove();
}
}
void BackGammon::newtheme()
{
ThemeDialog* theme=new ThemeDialog(this);
ImageNames names;
names.theme=theme_name;
names.board=board_name;
names.pieces1=piecesA_name;
names.pieces2=piecesB_name;
names.dice1=diceA_name;
names.dice2=diceB_name;
names.odds=odds_name;
names.table=table_name;
theme->setCurrent(names);
if(!theme->exec())
return;
names=theme->getNames();
theme_name=names.theme;
board_name=names.board;
piecesA_name=names.pieces1;
piecesB_name=names.pieces2;
diceA_name=names.dice1;
diceB_name=names.dice2;
odds_name=names.odds;
table_name=names.table;
applytheme();
}
void BackGammon::loadtheme()
{
FileDialog* file=new FileDialog(this,"Load Theme",".theme");
if(!file->exec())
return;
theme_name=file->filename();
- QString theme_file=QPEApplication::qpeDir()+"/backgammon/"+theme_name+".theme";
+ QString theme_file=QPEApplication::qpeDir()+"backgammon/"+theme_name+".theme";
Config theme(theme_file,Config::File);
theme.setGroup("theme");
board_name=theme.readEntry("board","board_1");
piecesA_name=theme.readEntry("pieces1","pieces_1");
piecesB_name=theme.readEntry("pieces2","pieces_2");
diceA_name=theme.readEntry("dice1","dice_1");
diceB_name=theme.readEntry("dice2","dice_2");
table_name=theme.readEntry("table","table_1");
odds_name=theme.readEntry("odds","odds_1");
applytheme();
}
void BackGammon::savetheme()
{
if(theme_name=="default")
{
QMessageBox::information(this,"Backgammon","Sorry\nCannot overwrite default.theme","OK");
return;
}
- QString theme_file=QPEApplication::qpeDir()+"/backgammon/"+theme_name+".theme";
+ QString theme_file=QPEApplication::qpeDir()+"backgammon/"+theme_name+".theme";
if(QMessageBox::information(this,"Backgammon","Save Theme\n"+theme_name,"Yes","No"))
return;
Config theme(theme_file,Config::File);
theme.setGroup("theme");
theme.writeEntry("board",board_name);
theme.writeEntry("pieces1",piecesA_name);
theme.writeEntry("pieces2",piecesB_name);
theme.writeEntry("dice1",diceA_name);
theme.writeEntry("dice2",diceB_name);
theme.writeEntry("table",table_name);
theme.writeEntry("odds",odds_name);
}
void BackGammon::themedefault()
{
if(QMessageBox::information(this,"Backgammon","Make Theme\n"+theme_name+"\nthe default theme","Yes","No"))
return;
Config conf("backgammon");
conf.setGroup("general");
conf.writeEntry("theme",theme_name);
}
void BackGammon::deletetheme()
{
FileDialog* file=new FileDialog(this,"Delete Theme",".theme");
if(!file->exec())
return;
theme_name=file->filename();
- QString theme_file=QPEApplication::qpeDir()+"/backgammon/"+theme_name+".theme";
+ QString theme_file=QPEApplication::qpeDir()+"backgammon/"+theme_name+".theme";
if(!QMessageBox::warning(this,tr( "Backgammon" ),tr( "deleted theme %1?").arg(theme_name),tr( "OK" ),tr( "Cancel" )))
{
QFile(theme_file).remove();
}
}
void BackGammon::modify_AI()
{
AI_Dialog* ai_mod=new AI_Dialog(this,tr( "Load Theme" ),".theme");
ai_mod->setAISettings(move->getAISettings());
if(!ai_mod->exec())
return;
//get the AI settings
AISettings ai=ai_mod->getAISettings();
move->setAISettings(ai);
//write new settings to conf file
Config conf("backgammon");
conf.setGroup("ai");
conf.writeEntry("rescue",ai.rescue);
conf.writeEntry("eliminate",ai.eliminate);
conf.writeEntry("expose",ai.expose);
conf.writeEntry("protect",ai.protect);
conf.writeEntry("safe",ai.safe);
conf.writeEntry("empty",ai.empty);
}
void BackGammon::setrules()
{
RulesDialog* rulesdialog=new RulesDialog(this,tr( "Load Theme" ),".theme");
rulesdialog->setRules(rules);
if(!rulesdialog->exec())
return;
rules=rulesdialog->getRules();
Config conf("backgammon");
conf.setGroup("rules");
conf.writeEntry("move_with_pieces_out",rules.move_with_pieces_out);
conf.writeEntry("nice_dice",rules.generous_dice);
move->setRules(rules);
}
void BackGammon::draw()
{
Pieces pieces;
move->position(pieces);
for(int a=0;a<15;a++)
{
if(!pieces.player1[a].side)
{
p1[a]->setX(pieces.player1[a].x);
p1[a]->setY(pieces.player1[a].y);
p1[a]->setZ(pieces.player1[a].z);
p1[a]->show();
p1_side[a]->hide();
}
else
{
p1_side[a]->setX(pieces.player1[a].x);
p1_side[a]->setY(pieces.player1[a].y);
p1_side[a]->setZ(pieces.player1[a].z);
p1_side[a]->show();
p1[a]->hide();
}
if(!pieces.player2[a].side)
{
p2[a]->setX(pieces.player2[a].x);
p2[a]->setY(pieces.player2[a].y);
p2[a]->setZ(pieces.player2[a].z);
p2[a]->show();
p2_side[a]->hide();
}
else
{
p2_side[a]->setX(pieces.player2[a].x);
p2_side[a]->setY(pieces.player2[a].y);
p2_side[a]->setZ(pieces.player2[a].z);
p2_side[a]->show();
p2[a]->hide();
}
}
}
void BackGammon::mouse(int x,int y)
{
if(gameFinished)
{
newgame();
return;
}
if(y<=200) //move pieces
{
if((player==1 && player1_auto) || (player==2 && player2_auto))
return;
diff --git a/noncore/games/backgammon/filedialog.cpp b/noncore/games/backgammon/filedialog.cpp
index e0a2914..f185188 100644
--- a/noncore/games/backgammon/filedialog.cpp
+++ b/noncore/games/backgammon/filedialog.cpp
@@ -1,61 +1,61 @@
#include "filedialog.h"
#include <qdir.h>
#include <qpe/qpeapplication.h>
FileDialog::FileDialog(QWidget* parent,QString header,QString extension,const char* name,bool modal,WFlags f)
:QDialog(parent,name,modal,f)
{
setCaption(header);
ext=extension;
dirselector=new QListView(this);
dirselector->setGeometry(1,10,235,200);
dirselector->addColumn("Files");
connect(dirselector,SIGNAL(clicked(QListViewItem*)),this,SLOT(selectorclicked(QListViewItem*)));
getCurrentDir();
file_name="user";
fileinput=new QLineEdit(file_name,this);
fileinput->setGeometry(1,220,235,20);
QPEApplication::showDialog( this );
}
FileDialog::~FileDialog()
{}
void FileDialog::selectorclicked(QListViewItem* entry)
{
if(entry==NULL)
return;
file_name=entry->text(0);
fileinput->setText(file_name);
}
void FileDialog::getCurrentDir()
{
dirselector->clear();
- QDir dir(QPEApplication::qpeDir()+"/backgammon");
+ QDir dir(QPEApplication::qpeDir()+"backgammon");
dir.setFilter(QDir::Files);
QFileInfoListIterator it(*(dir.entryInfoList()));
QFileInfo* fi;
int ext_length=ext.length();
while((fi=it.current())) // go through all file and subdirs
{
QString file=fi->fileName();
if(file.right(ext_length)==ext && file)
{
file=file.left(file.length()-ext_length);
new QListViewItem(dirselector,file);
}
++it;
}
}
QString FileDialog::filename()
{
return file_name;
}
diff --git a/noncore/games/backgammon/themedialog.cpp b/noncore/games/backgammon/themedialog.cpp
index afd6a1b..9bdb6a9 100644
--- a/noncore/games/backgammon/themedialog.cpp
+++ b/noncore/games/backgammon/themedialog.cpp
@@ -50,112 +50,112 @@ ThemeDialog::ThemeDialog(QWidget* parent,const char* name,bool modal,WFlags f)
boxodds->setGeometry(40,200,195,20);
fillBox("odds",boxodds);
boxodds->setEnabled(false);
QLabel* labeltable=new QLabel("table",this);
labeltable->setGeometry(0,225,40,20);
boxtable=new QComboBox(this);
boxtable->setGeometry(40,225,195,20);
fillBox("table",boxtable);
QPEApplication::showDialog( this );
}
ThemeDialog::~ThemeDialog()
{}
ImageNames ThemeDialog::getNames()
{
ImageNames names;
names.theme=lineName->text();
names.board=boxboard->currentText();
names.pieces1=boxpiecesA->currentText();
names.pieces2=boxpiecesB->currentText();
names.dice1=boxdiceA->currentText();
names.dice2=boxdiceB->currentText();
names.odds=boxodds->currentText();
names.table=boxtable->currentText();
return names;
}
void ThemeDialog::setCurrent(const ImageNames& current)
{
int a=0;
lineName->setText(current.theme);
for(a=0;a<boxboard->count();a++)
{
if(boxboard->text(a)==current.board)
{
boxboard->setCurrentItem(a);
break;
}
}
for(a=0;a<boxpiecesA->count();a++)
{
if(boxpiecesA->text(a)==current.pieces1)
{
boxpiecesA->setCurrentItem(a);
break;
}
}
for(a=0;a<boxpiecesB->count();a++)
{
if(boxpiecesB->text(a)==current.pieces2)
{
boxpiecesB->setCurrentItem(a);
break;
}
}
for(a=0;a<boxdiceA->count();a++)
{
if(boxdiceA->text(a)==current.dice1)
{
boxdiceA->setCurrentItem(a);
break;
}
}
for(a=0;a<boxdiceB->count();a++)
{
if(boxdiceB->text(a)==current.dice2)
{
boxdiceB->setCurrentItem(a);
break;
}
}
for(a=0;a<boxodds->count();a++)
{
if(boxodds->text(a)==current.odds)
{
boxodds->setCurrentItem(a);
break;
}
}
for(a=0;a<boxtable->count();a++)
{
if(boxtable->text(a)==current.table)
{
boxtable->setCurrentItem(a);
break;
}
}
}
void ThemeDialog::fillBox(QString dirname,QComboBox* thebox)
{
thebox->clear();
- QDir dir(QPEApplication::qpeDir()+"/pics/backgammon/"+dirname);
+ QDir dir(QPEApplication::qpeDir()+"pics/backgammon/"+dirname);
dir.setFilter(QDir::Dirs | QDir::Files);
QFileInfoListIterator it(*(dir.entryInfoList()));
QFileInfo* fi;
while((fi=it.current())) // go through all file and subdirs
{
QString file=fi->fileName();
if(file.right(4)==".png")
{
thebox->insertItem(file.left(file.find(".png")));
}
++it;
}
delete fi;
}
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index dc2c496..2e9553f 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -856,193 +856,193 @@ void PlayListWidget::writem3u() {
lnk.setName( name); //sets file name
// odebug << filename << oendl;
Config config( "OpiePlayer" );
config.setGroup( "PlayList" );
config.writeEntry("CurrentPlaylist",filename);
currentPlayList=filename;
if(!lnk.writeLink()) {
odebug << "Writing doclink did not work" << oendl;
}
setCaption(tr("OpiePlayer: ") + name);
}
}
}
void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) {
switch ( e->key() ) {
////////////////////////////// Zaurus keys
case Key_F9: //activity
// if(audioUI->isHidden())
// audioUI->showMaximized();
break;
case Key_F10: //contacts
// if( videoUI->isHidden())
// videoUI->showMaximized();
break;
case Key_F11: //menu
break;
case Key_F12: //home
// doBlank();
break;
case Key_F13: //mail
// doUnblank();
break;
case Key_Q: //add to playlist
addSelected();
break;
case Key_R: //remove from playlist
removeSelected();
break;
// case Key_P: //play
// odebug << "Play" << oendl;
// playSelected();
// break;
case Key_Space:
// playSelected(); puh
break;
case Key_1:
tabWidget->setCurrentPage( 0 );
break;
case Key_2:
tabWidget->setCurrentPage( 1 );
break;
case Key_3:
tabWidget->setCurrentPage( 2 );
break;
case Key_4:
tabWidget->setCurrentPage( 3 );
break;
case Key_Down:
if ( !d->selectedFiles->next() )
d->selectedFiles->first();
break;
case Key_Up:
if ( !d->selectedFiles->prev() )
// d->selectedFiles->last();
break;
}
}
void PlayListWidget::pmViewActivated(int index) {
// odebug << "" << index << "" << oendl;
switch(index) {
case -16:
{
mediaPlayerState->toggleFullscreen();
bool b=mediaPlayerState->isFullscreen();
pmView->setItemChecked( index, b);
Config cfg( "OpiePlayer" );
cfg.writeEntry( "FullScreen", b );
}
break;
};
}
void PlayListWidget::populateSkinsMenu() {
int item = 0;
defaultSkinIndex = 0;
QString skinName;
Config cfg( "OpiePlayer" );
cfg.setGroup("Options" );
QString skin = cfg.readEntry( "Skin", "default" );
- QDir skinsDir( QPEApplication::qpeDir() + "/pics/opieplayer2/skins" );
+ QDir skinsDir( QPEApplication::qpeDir() + "pics/opieplayer2/skins" );
skinsDir.setFilter( QDir::Dirs );
skinsDir.setSorting(QDir::Name );
const QFileInfoList *skinslist = skinsDir.entryInfoList();
QFileInfoListIterator it( *skinslist );
QFileInfo *fi;
while ( ( fi = it.current() ) ) {
skinName = fi->fileName();
// odebug << fi->fileName() << oendl;
if( skinName != "." && skinName != ".." && skinName !="CVS" ) {
item = skinsMenu->insertItem( fi->fileName() ) ;
}
if( skinName == "default" ) {
defaultSkinIndex = item;
}
if( skinName == skin ) {
skinsMenu->setItemChecked( item, TRUE );
}
++it;
}
}
void PlayListWidget::skinsMenuActivated( int item ) {
for(unsigned int i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i-- ) {
skinsMenu->setItemChecked( i, FALSE );
}
skinsMenu->setItemChecked( item, TRUE );
{
Config cfg( "OpiePlayer" );
cfg.setGroup("Options");
cfg.writeEntry("Skin", skinsMenu->text( item ) );
}
emit skinSelected();
}
PlayListWidget::TabType PlayListWidget::currentTab() const
{
static const TabType indexToTabType[ TabTypeCount ] =
{ CurrentPlayList, AudioFiles, VideoFiles, PlayLists };
int index = tabWidget->currentPageIndex();
assert( index < TabTypeCount && index >= 0 );
return indexToTabType[ index ];
}
PlayListWidget::Entry PlayListWidget::currentEntry() const
{
if ( currentTab() == CurrentPlayList ) {
const DocLnk *lnk = current();
return Entry( lnk->name(), lnk->file() );
}
return Entry( currentFileListPathName() );
}
QString PlayListWidget::currentFileListPathName() const {
return currentFileListView->currentItem()->text( 3 );
}
void PlayListWidget::qcopReceive(const QCString &msg, const QByteArray &data) {
QDataStream stream ( data, IO_ReadOnly );
if ( msg == "play()" ) { //plays current selection
btnPlay( true);
} else if ( msg == "stop()" ) {
mediaPlayerState->setPlaying( false);
} else if ( msg == "togglePause()" ) {
mediaPlayerState->togglePaused();
} else if ( msg == "next()" ) { //select next in list
mediaPlayerState->setNext();
} else if ( msg == "prev()" ) { //select previous in list
mediaPlayerState->setPrev();
} else if ( msg == "toggleLooping()" ) { //loop or not loop
mediaPlayerState->toggleLooping();
} else if ( msg == "toggleShuffled()" ) { //shuffled or not shuffled
mediaPlayerState->toggleShuffled();
} else if ( msg == "volUp()" ) { //volume more
// emit moreClicked();
// emit moreReleased();
} else if ( msg == "volDown()" ) { //volume less
// emit lessClicked();
// emit lessReleased();
} else if ( msg == "play(QString)" ) { //play this now
QString file;
stream >> file;
setDocument( (const QString &) file);
} else if ( msg == "add(QString)" ) { //add to playlist
QString file;
stream >> file;
QFileInfo fileInfo(file);
DocLnk lnk;
lnk.setName( fileInfo.baseName() ); //sets name
lnk.setFile( file ); //sets file name
addToSelection( lnk );
diff --git a/noncore/settings/language/language.cpp b/noncore/settings/language/language.cpp
index 81d6717..14750ac 100644
--- a/noncore/settings/language/language.cpp
+++ b/noncore/settings/language/language.cpp
@@ -1,156 +1,156 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include "settings.h"
#include <qpe/global.h>
#include <qpe/fontmanager.h>
#include <qpe/config.h>
#include <qpe/applnk.h>
#include <qpe/qpedialog.h>
#include <qpe/qpeapplication.h>
#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
#include <qpe/qcopenvelope_qws.h>
#endif
#include <qlabel.h>
#include <qcheckbox.h>
#include <qradiobutton.h>
#include <qtabwidget.h>
#include <qslider.h>
#include <qfile.h>
#include <qtextstream.h>
#include <qdatastream.h>
#include <qmessagebox.h>
#include <qcombobox.h>
#include <qspinbox.h>
#include <qlistbox.h>
#include <qdir.h>
#if QT_VERSION >= 300
#include <qstylefactory.h>
#endif
#include <stdlib.h>
LanguageSettings::LanguageSettings( QWidget* parent, const char* name, WFlags fl )
: LanguageSettingsBase( parent, name, TRUE, fl )
{
if ( FontManager::hasUnicodeFont() )
languages->setFont(FontManager::unicodeFont(FontManager::Proportional));
- QString tfn = QPEApplication::qpeDir() + "/i18n/";
+ QString tfn = QPEApplication::qpeDir() + "i18n/";
QDir langDir = tfn;
QStringList list = langDir.entryList("*", QDir::Dirs );
QStringList::Iterator it;
for ( it = list.begin(); it != list.end(); ++it ) {
QString name = (*it);
QFileInfo desktopFile( tfn + "/" + name + "/.directory" );
if ( desktopFile.exists() ) {
langAvail.append(name);
Config conf( desktopFile.filePath(), Config::File );
QString langName = conf.readEntry( "Name" );
QString ownName = conf.readEntryDirect( "Name[" + name + "]" );
if ( ownName.isEmpty() )
ownName = conf.readEntryDirect( "Name" );
if ( !ownName.isEmpty() && ownName != langName )
langName = langName + " [" + ownName + "]";
languages->insertItem( langName );
}
}
if ( langAvail. find ( "en" ) == -1 ) {
langAvail. prepend ( "" ); // no tr
languages-> insertItem ( QString ( "English [%1] (%2)" /* no tr (!) */ ). arg ( tr ( "English" )). arg ( tr( "default" )), 0 );
}
dl = new QPEDialogListener(this);
reset();
}
LanguageSettings::~LanguageSettings()
{}
void LanguageSettings::accept()
{
Config c( "qpe" );
c.setGroup( "Startup" );
if ( ( c.readNumEntry( "FirstUse", 42 ) == 0 ) &&
( QMessageBox::warning( this, tr("Language"), tr("<qt>Attention, all windows will be closed by changing the language\n"
"without saving the Data.<br><br>Go on?</qt>"), 1, 2) )
== QMessageBox::Cancel )
return;
applyLanguage();
QDialog::accept();
}
void LanguageSettings::applyLanguage()
{
setLanguage ( langAvail. at ( languages-> currentItem ( )));
}
void LanguageSettings::reject()
{
reset();
QDialog::reject();
}
void LanguageSettings::reset()
{
QString l = getenv("LANG");
Config config("locale");
config.setGroup("Language");
l = config.readEntry( "Language", l );
actualLanguage = l;
if (l.isEmpty())
l = "en";
int n = langAvail.find( l );
languages->setCurrentItem( n );
}
QString LanguageSettings::actualLanguage;
void LanguageSettings::setLanguage(const QString& lang)
{
if ( lang != actualLanguage ) {
Config config("locale");
config.setGroup( "Language" );
if ( lang. isEmpty ( ))
config. removeEntry ( "Language" );
else
config.writeEntry( "Language", lang );
config.write();
#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
QCopEnvelope e("QPE/System", "language(QString)");
e << lang;
#endif
}
}
void LanguageSettings::done(int r)
{
diff --git a/noncore/settings/networksettings/mainwindow/mainwindowimp.cpp b/noncore/settings/networksettings/mainwindow/mainwindowimp.cpp
index fb7d7c9..5f23aea 100644
--- a/noncore/settings/networksettings/mainwindow/mainwindowimp.cpp
+++ b/noncore/settings/networksettings/mainwindow/mainwindowimp.cpp
@@ -195,193 +195,193 @@ void MainWindowImp::getAllInterfaces()
{
if((loc = line.find(":")) != -1)
{
ifaces += line.left(loc);
}
}
}
for (QStringList::Iterator it = ifaces.begin(); it != ifaces.end(); ++it)
{
int flags = 0;
if ( m_handledIfaces.contains( (*it) ) )
{
odebug << " " << (*it).latin1() << " is handled by a module" << oendl;
continue;
}
// int family;
i = NULL;
strcpy(ifr.ifr_name, (*it).latin1());
struct ifreq ifcopy;
ifcopy = ifr;
result = ioctl(sockfd, SIOCGIFFLAGS, &ifcopy);
flags = ifcopy.ifr_flags;
i = new Interface(this, ifr.ifr_name, false);
i->setAttached(true);
if ((flags & IFF_UP) == IFF_UP)
i->setStatus(true);
else
i->setStatus(false);
if ((flags & IFF_BROADCAST) == IFF_BROADCAST)
i->setHardwareName("Ethernet");
else if ((flags & IFF_POINTOPOINT) == IFF_POINTOPOINT)
i->setHardwareName("Point to Point");
else if ((flags & IFF_MULTICAST) == IFF_MULTICAST)
i->setHardwareName("Multicast");
else if ((flags & IFF_LOOPBACK) == IFF_LOOPBACK)
i->setHardwareName("Loopback");
else
i->setHardwareName("Unknown");
owarn << "Adding interface " << ifr.ifr_name << " to interfaceNames\n" << oendl;
interfaceNames.insert(i->getInterfaceName(), i);
updateInterface(i);
connect(i, SIGNAL(updateInterface(Interface*)),
this, SLOT(updateInterface(Interface*)));
}
// now lets ask the plugins too ;)
QMap<Module*, QLibrary*>::Iterator it;
QList<Interface> ilist;
for( it = libraries.begin(); it != libraries.end(); ++it )
{
if(it.key())
{
ilist = it.key()->getInterfaces();
for( i = ilist.first(); i != 0; i = ilist.next() )
{
owarn << "Adding interface " << i->getInterfaceName().latin1() << " to interfaceNames\n" << oendl;
interfaceNames.insert(i->getInterfaceName(), i);
updateInterface(i);
connect(i, SIGNAL(updateInterface(Interface*)),
this, SLOT(updateInterface(Interface*)));
}
}
}
}
/**
* Load all modules that are found in the path
* @param path a directory that is scaned for any plugins that can be loaded
* and attempts to load them
*/
void MainWindowImp::loadModules(const QString &path)
{
#ifdef DEBUG
odebug << "MainWindowImp::loadModules: " << path.latin1() << "" << oendl;
#endif
QDir d(path);
if(!d.exists())
return;
QString lang = ::getenv("LANG");
// Don't want sym links
d.setFilter( QDir::Files | QDir::NoSymLinks );
const QFileInfoList *list = d.entryInfoList();
QFileInfoListIterator it( *list );
QFileInfo *fi;
while ( (fi=it.current()) )
{
if(fi->fileName().contains(".so"))
{
/* if loaded install translation */
if( loadPlugin(path + "/" + fi->fileName()) != 0l ){
QTranslator *trans = new QTranslator(qApp);
- QString fn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+ fi->fileName().left( fi->fileName().find(".") )+".qm";
+ QString fn = QPEApplication::qpeDir()+"i18n/"+lang+"/"+ fi->fileName().left( fi->fileName().find(".") )+".qm";
if( trans->load( fn ) )
qApp->installTranslator( trans );
else
delete trans;
}
odebug << "loaded plugin: >" << QString(path + "/" + fi->fileName()).latin1() << "< " << oendl;
}
++it;
}
}
/**
* Attempt to load a function and resolve a function.
* @param pluginFileName - the name of the file in which to attempt to load
* @param resolveString - function pointer to resolve
* @return pointer to the function with name resolveString or NULL
*/
Module* MainWindowImp::loadPlugin(const QString &pluginFileName, const QString &resolveString)
{
#ifdef DEBUG
odebug << "MainWindowImp::loadPlugin: " << pluginFileName.latin1() << ": resolving " << resolveString.latin1() << "" << oendl;
#endif
QLibrary *lib = new QLibrary(pluginFileName);
void *functionPointer = lib->resolve(resolveString);
if( !functionPointer )
{
#ifdef DEBUG
odebug << "MainWindowImp::loadPlugin: Warning: " << pluginFileName.latin1() << " is not a plugin" << oendl;
#endif
delete lib;
return 0;
}
// Try to get an object.
Module *object = ((Module* (*)()) functionPointer)();
if(object == 0)
{
#ifdef DEBUG
odebug << "MainWindowImp: Couldn't create object, but did load library!" << oendl;
#endif
delete lib;
return 0;
}
m_handledIfaces += object->handledInterfaceNames();
// Store for deletion later
libraries.insert(object, lib);
return object;
}
/**
* The Add button was clicked. Bring up the add dialog and if OK is hit
* load the plugin and append it to the list
*/
void MainWindowImp::addClicked()
{
QMap<Module*, QLibrary*>::Iterator it;
QMap<QString, QString> list;
QMap<QString, Module*> newInterfaceOwners;
for( it = libraries.begin(); it != libraries.end(); ++it )
{
if(it.key())
{
(it.key())->possibleNewInterfaces(list);
}
}
// See if the list has anything that we can add.
if(list.count() == 0)
{
QMessageBox::information(this, "Sorry", "Nothing to add.", QMessageBox::Ok);
return;
}
AddConnectionImp addNewConnection(this, "AddConnectionImp", true);
addNewConnection.addConnections(list);
if( QDialog::Accepted == QPEApplication::execDialog( &addNewConnection ) )
{
QListViewItem *item = addNewConnection.registeredServicesList->currentItem();
if(!item)
return;
for( it = libraries.begin(); it != libraries.end(); ++it )
{
if(it.key())
{
Interface *i = (it.key())->addNewInterface(item->text(0));
if(i)
{
odebug << "iface name " << i->getInterfaceName().latin1() << "" << oendl;
interfaceNames.insert(i->getInterfaceName(), i);
updateInterface(i);
}
}
}
}
}
diff --git a/noncore/settings/sysinfo/benchmarkinfo.cpp b/noncore/settings/sysinfo/benchmarkinfo.cpp
index 793fcb1..060185a 100644
--- a/noncore/settings/sysinfo/benchmarkinfo.cpp
+++ b/noncore/settings/sysinfo/benchmarkinfo.cpp
@@ -49,193 +49,193 @@ using namespace Opie::Ui;
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#if defined (__GNUC__) && (__GNUC__ < 3)
#define round qRound
#endif
extern "C"
{
void BenchFFT( void );
double dhry_main( int );
}
#define DHRYSTONE_RUNS 20000000
#define TEST_DURATION 3
//===========================================================================
class BenchmarkPaintWidget : public QWidget
{
public:
BenchmarkPaintWidget() : QWidget( 0, "Benchmark Paint Widget", WStyle_Customize|WStyle_StaysOnTop|WPaintUnclipped|WPaintClever )
{
resize( QApplication::desktop()->size() );
show();
p.begin( this );
};
~BenchmarkPaintWidget()
{
p.end();
hide();
};
QPainter p;
};
//===========================================================================
BenchmarkInfo::BenchmarkInfo( QWidget *parent, const char *name, int wFlags )
: QWidget( parent, name, wFlags )
{
setMinimumSize( 200, 150 );
QVBoxLayout* vb = new QVBoxLayout( this );
vb->setSpacing( 4 );
vb->setMargin( 4 );
tests = new OListView( this );
QWhatsThis::add( tests->viewport(), tr( "This area shows the available tests, the results for which the tests "
"have been performed, and comparison values for one selected device. "
"Use the checkboxes to define which tests you want to perform." ) );
tests->setMargin( 0 );
tests->addColumn( tr( "Tests" ) );
tests->addColumn( tr( "Results" ) );
tests->addColumn( tr( "Comparison" ) );
tests->setShowSortIndicator( true );
test_alu = new OCheckListItem( tests, tr( "1. Integer Arithmetic " ), OCheckListItem::CheckBox );
test_fpu = new OCheckListItem( tests, tr( "2. Floating Point Unit " ), OCheckListItem::CheckBox );
test_txt = new OCheckListItem( tests, tr( "3. Text Rendering " ), OCheckListItem::CheckBox );
test_gfx = new OCheckListItem( tests, tr( "4. Gfx Rendering " ), OCheckListItem::CheckBox );
test_ram = new OCheckListItem( tests, tr( "5. RAM Performance " ), OCheckListItem::CheckBox );
#ifndef QT_QWS_RAMSES
test_sd = new OCheckListItem( tests, tr( "6. SD Card Performance " ), OCheckListItem::CheckBox );
test_cf = new OCheckListItem( tests, tr( "7. CF Card Performance " ), OCheckListItem::CheckBox );
#endif
test_alu->setText( 1, "n/a" );
test_fpu->setText( 1, "n/a" );
test_txt->setText( 1, "n/a" );
test_gfx->setText( 1, "n/a" );
test_ram->setText( 1, "n/a" );
#ifndef QT_QWS_RAMSES
test_sd->setText( 1, "n/a" );
test_cf->setText( 1, "n/a" );
#endif
test_alu->setText( 2, "n/a" );
test_fpu->setText( 2, "n/a" );
test_txt->setText( 2, "n/a" );
test_gfx->setText( 2, "n/a" );
test_ram->setText( 2, "n/a" );
#ifndef QT_QWS_RAMSES
test_sd->setText( 2, "n/a" );
test_cf->setText( 2, "n/a" );
#endif
startButton = new QPushButton( tr( "&Start Tests!" ), this );
QWhatsThis::add( startButton, tr( "Click here to perform the selected tests." ) );
connect( startButton, SIGNAL( clicked() ), this, SLOT( run() ) );
vb->addWidget( tests, 2 );
QHBoxLayout* hb = new QHBoxLayout( vb );
hb->addWidget( startButton, 2 );
- QFile f( QPEApplication::qpeDir() + "/share/sysinfo/results" );
+ QFile f( QPEApplication::qpeDir() + "share/sysinfo/results" );
if ( f.open( IO_ReadOnly ) )
{
machineCombo = new QComboBox( this );
QWhatsThis::add( machineCombo, tr( "Choose a model to compare your results with." ) );
QTextStream ts( &f );
while( !ts.eof() )
{
QString machline = ts.readLine();
odebug << "sysinfo: parsing benchmark results for '" << machline << "'" << oendl;
QString resline = ts.readLine();
machines.insert( machline, new QStringList( QStringList::split( ",", resline ) ) );
machineCombo->insertItem( machline );
}
hb->addWidget( new QLabel( tr( "Compare:" ), this ) );
hb->addWidget( machineCombo, 2 );
connect( machineCombo, SIGNAL( activated(int) ), this, SLOT( machineActivated(int) ) );
}
}
BenchmarkInfo::~BenchmarkInfo()
{}
void BenchmarkInfo::machineActivated( int index )
{
QStringList* results = machines[ machineCombo->text( index ) ];
if ( !results )
{
odebug << "sysinfo: no results available." << oendl;
return;
}
QStringList::Iterator it = results->begin();
test_alu->setText( 2, *(it++) );
test_fpu->setText( 2, *(it++) );
test_txt->setText( 2, *(it++) );
test_gfx->setText( 2, *(it++) );
test_ram->setText( 2, *(it++) );
#ifndef QT_QWS_RAMSES
test_sd->setText( 2, *(it++) );
test_cf->setText( 2, *(it++) );
#endif
}
void BenchmarkInfo::run()
{
startButton->setText( "> Don't touch! <" );
qApp->processEvents();
QTime t;
if ( test_alu->isOn() )
{
int d = round( dhry_main( DHRYSTONE_RUNS ) );
test_alu->setText( 1, QString().sprintf( "%d dhrys", d ) );
test_alu->setOn( false );
}
if ( test_fpu->isOn() )
{
t.start();
BenchFFT();
test_fpu->setText( 1, QString().sprintf( "%.2f secs", t.elapsed() / 1000.0 ) );;
test_fpu->setOn( false );
}
if ( test_txt->isOn() )
{
int value = textRendering( TEST_DURATION );
test_txt->setText( 1, QString().sprintf( "%d chars/sec", value / TEST_DURATION ) );
test_txt->setOn( false );
}
if ( test_gfx->isOn() )
{
int value = gfxRendering( TEST_DURATION );
test_gfx->setText( 1, QString().sprintf( "%.2f gops/sec", value / 4.0 / TEST_DURATION ) ); // 4 tests
test_gfx->setOn( false );
}
if ( test_ram->isOn() ) // /tmp is supposed to be in RAM on a PDA
{
performFileTest( "/tmp/benchmarkFile.dat", test_ram );
}
#ifndef QT_QWS_RAMSES
if ( test_cf->isOn() )
{
OStorageInfo storage;
performFileTest( storage.cfPath() + "/benchmarkFile.dat", test_cf );
}
if ( test_sd->isOn() )
{
diff --git a/noncore/settings/tabmanager/tabmanager.cpp b/noncore/settings/tabmanager/tabmanager.cpp
index 3eae424..85e5814 100644
--- a/noncore/settings/tabmanager/tabmanager.cpp
+++ b/noncore/settings/tabmanager/tabmanager.cpp
@@ -1,120 +1,120 @@
#include "tabmanager.h"
#include "app.h"
#include "wait.h"
#include "tabapplnk.h"
#include <opie2/odebug.h>
#include <qpe/applnk.h>
#include <qdir.h>
#include <qfile.h>
#include <qtextstream.h>
#include <qlistview.h>
#include <qheader.h>
#include <qcombobox.h>
#include <qlineedit.h>
#include <qlabel.h>
#include <qmessagebox.h>
#include <stdlib.h>
#include <qpe/qcopenvelope_qws.h>
#include <qpe/qpeapplication.h>
#include <qpe/resource.h>
-#define HOME_APP_DIR QPEApplication::qpeDir()+"/apps"
+#define HOME_APP_DIR QPEApplication::qpeDir()+"apps"
#define HOME_APP_INSTALL_DIR "/usr/lib/ipkg/info"
#define NEW_FOLDER "EmptyTab"
#define NEW_APPLICATION "NewApp"
#define APPLICATION_EXTENSION ".desktop"
#define APPLICATION_EXTENSION_LENGTH 8
/**
* Constructor. Sets up signals. Performs initial scan of applications
* and tabs
*/
TabManager::TabManager( QWidget* parent, const char* name):TabManagerBase(parent, name), changed(false), application(NULL){
rescanFolder(HOME_APP_DIR);
// Connect the signals and slots
connect(tabList, SIGNAL(doubleClicked(QListViewItem*)), this, SLOT(editItem(QListViewItem*)));
(tabList->header())->hide();
connect(tabList, SIGNAL(moveItem(QListViewItem*,QListViewItem*)), this, SLOT(moveApplication(QListViewItem*,QListViewItem*)));
}
/**
* If anything in the tab's have been changed then update the system or alert
* the user.
*/
TabManager::~TabManager(){
if(changed){
// Prompt.
//int answer = QMessageBox::warning(this, "Message", "Should your desktop be","Yes", "Cancel", 0, 1 );
//if (answer)
// return;
QCopEnvelope e("QPE/System", "linkChanged(QString)");
QString link; //we'll just send an empty string
e << link;
}
}
/**
* Scans root directory for any tabs or applications. Will recursivly go down,
* but will not follow symlinks.
* @param directory - the directory to look in.
* @param parent - the parent to place any new tabs or apps into. If parent is
* NULL then the item is a tab and should be placed as a child of the window.
*/
void TabManager::rescanFolder(QString directory, QListViewItem* parent){
//odebug << QString("rescanFolder: ") + directory.latin1() << oendl;
QDir d;
d.setPath(directory);
// Show hidden files for .directories
d.setFilter( QDir::Files | QDir::Hidden | QDir::Dirs);
const QFileInfoList *list = d.entryInfoList();
QFileInfoListIterator it( *list ); // create list iterator
QFileInfo *fi; // pointer for traversing
while ( (fi=it.current()) ) { // for each file...
// If it is a dir and not .. or . then add it as a tab and go down.
if(fi->isDir()){
if(fi->fileName() != ".." && fi->fileName() != ".") {
QListViewItem* newItem;
if(!parent)
newItem = new QListViewItem(tabList, fi->fileName());
else
newItem = new QListViewItem(parent, fi->fileName());
itemList.insert(newItem, directory + "/" + fi->fileName() + "/.directory" );
rescanFolder(directory + "/" + fi->fileName(), newItem);
}
}
else{
// it is a file, if not a .directory add to parent.
// Change parents name and icon to reflect icon.
if(fi->fileName() == ".directory"){
AppLnk app(directory + "/" + fi->fileName());
if(parent){
parent->setPixmap(0,app.pixmap());
parent->setText(0, app.name());
}
}
else{
// Add any desktop files found.
QListViewItem* newItem;
if(directory != HOME_APP_DIR){
if(!parent)
newItem = new QListViewItem(tabList, fi->fileName());
else
newItem = new QListViewItem(parent, fi->fileName());
if(fi->fileName().right(APPLICATION_EXTENSION_LENGTH) == APPLICATION_EXTENSION){
AppLnk app(directory + "/" + fi->fileName());
newItem->setPixmap(0,app.pixmap());
newItem->setText(0, app.name());
itemList.insert(newItem, directory + "/" + fi->fileName());
}
}
}
}
++it; // goto next list element
@@ -165,193 +165,193 @@ void TabManager::newApplication(){
itemList.insert(newItem, homeLocation );
// We have changed something.
changed = true;
}
/**
* Remove the item.
* Check if we can
* Prompt user
* Delete physical file (Dir, remove .dir, then dir. File, remove file)
* Remove from installer if need too.
*/
void TabManager::removeItem(){
// Make sure we can delete
QListViewItem *item = tabList->currentItem();
if(!item)
return;
if(item->childCount() > 0){
QMessageBox::critical(this, tr("Message"), tr("Can't remove with applications\nstill in the group."), tr("Ok") );
return;
}
// Prompt.
int answer = QMessageBox::warning(this, tr("Message"), tr("Are you sure you want to delete?"), tr("Yes"), tr("Cancel"), 0, 1 );
if (answer)
return;
bool removeSuccessful = true;
QString location = itemList[item];
// Remove file (.directory in a Directory case)
if(!QFile::remove(location))
removeSuccessful = false;
// Remove directory
if(item->parent() == NULL){
// Remove .directory file string
location = location.mid(0,location.length()-10);
QDir dir;
if(!dir.rmdir(location))
removeSuccessful = false;
else
removeSuccessful = true;
}
// If removing failed.
if(!removeSuccessful){
odebug << (QString("removeItem: ") + location).latin1() << oendl;
QMessageBox::critical(this, tr("Message"), tr("Can't remove."), tr("Ok") );
return;
}
// Remove from the installer so it wont fail.
// Don't need to do this sense the current install uses rm -f so no error
// Remove from the gui list.
itemList.remove(item);
if(item->parent())
item->parent()->takeItem(item);
delete item;
// We have changed something.
changed = true;
}
/**
* Helper function. Edits the current item.
* calls editItem with the currently selected item.
*/
void TabManager::editCurrentItem(){
editItem(tabList->currentItem());
}
/**
* Edit the item that is passed in.
* Show application dialog and if anything changed
* @param item the item to edit.
*/
void TabManager::editItem( QListViewItem * item){
if(!item)
return;
TabAppLnk app(itemList[item]);
if(!app.isValid()){
odebug << QString("editItem: Not a valid applnk file: ") + itemList[item].latin1() << oendl;
return;
}
// Fill with all of the icons
if(!application){
Wait waitDialog(this, "Wait dialog");
waitDialog.waitLabel->setText(tr("Gathering icons..."));
waitDialog.show();
qApp->processEvents();
application = new AppEdit(this, "Application edit", true);
- QDir d(QPEApplication::qpeDir() + "/pics/");
+ QDir d(QPEApplication::qpeDir() + "pics/");
d.setFilter( QDir::Files);
const QFileInfoList *list = d.entryInfoList();
QFileInfoListIterator it( *list ); // create list iterator
QFileInfo *fi; // pointer for traversing
while ( (fi=it.current()) ) { // for each file...
QString fileName = fi->fileName();
if(fileName.right(4) == ".png"){
fileName = fileName.mid(0,fileName.length()-4);
QPixmap imageOfFile(Resource::loadPixmap(fileName));
QImage foo = imageOfFile.convertToImage();
foo = foo.smoothScale(16,16);
imageOfFile.convertFromImage(foo);
application->iconLineEdit->insertItem(imageOfFile,fileName);
}
//odebug << fi->fileName().latin1() << oendl;
++it;
}
waitDialog.hide();
}
int pixmap = -1;
QString pixmapText = app.pixmapString();
QComboBox *f = application->iconLineEdit;
for(int i = 0; i < application->iconLineEdit->count(); i++){
if(f->text(i) == pixmapText){
pixmap = i;
break;
}
}
if(pixmap != -1)
application->iconLineEdit->setCurrentItem(pixmap);
else if(pixmapText.isEmpty()){
application->iconLineEdit->setCurrentItem(0);
}
else{
QPixmap imageOfFile(Resource::loadPixmap(pixmapText));
QImage foo = imageOfFile.convertToImage();
foo = foo.smoothScale(16,16);
imageOfFile.convertFromImage(foo);
application->iconLineEdit->insertItem(imageOfFile,pixmapText,0);
application->iconLineEdit->setCurrentItem(0);
}
application->nameLineEdit->setText(app.name());
application->execLineEdit->setText(app.exec());
application->commentLineEdit->setText(app.comment());
if(item->parent() == NULL){
application->execLineEdit->setEnabled(false);
application->TextLabel3->setEnabled(false);
application->setCaption(tr("Tab"));
}
else{
application->execLineEdit->setEnabled(true);
application->TextLabel3->setEnabled(true);
application->setCaption(tr("Application"));
}
// Only do somthing if they hit OK
application->showMaximized();
if(application->exec() == 0)
return;
// If nothing has changed exit (hmmm why did they hit ok?)
if(app.name() == application->nameLineEdit->text() &&
app.pixmapString() == application->iconLineEdit->currentText() &&
app.comment() == application->commentLineEdit->text() &&
app.exec() == application->execLineEdit->text())
return;
// Change the applnk file
QString oldName = app.name();
app.setName(application->nameLineEdit->text());
app.setIcon(application->iconLineEdit->currentText());
app.setComment(application->commentLineEdit->text());
app.setExec(application->execLineEdit->text());
if(!app.writeLink()){
QMessageBox::critical(this, tr("Message"), "Can't save.", tr("Ok") );
return;
}
// Update the gui icon and name
item->setText(0,app.name());
item->setPixmap(0,app.pixmap());
// We have changed something.
changed = true;
// If we were dealing with a new folder or new application change
// the file names. Also change the item location in itemList
if(oldName == NEW_FOLDER){
QDir r;
QString oldName = itemList[item];
oldName = oldName.mid(0,oldName.length()-11);
QString newName = oldName.mid(0,oldName.length()-9);
diff --git a/noncore/styles/theme/othemebase.cpp b/noncore/styles/theme/othemebase.cpp
index d2226e6..4275dd6 100644
--- a/noncore/styles/theme/othemebase.cpp
+++ b/noncore/styles/theme/othemebase.cpp
@@ -213,193 +213,193 @@ void OThemeBase::copyWidgetConfig( int sourceID, int destID, QString *pixnames,
pixmaps[ destID ] = NULL;
images[ destID ] = NULL;
if ( !pixnames[ destID ].isEmpty() ) {
if ( scaleHints[ sourceID ] == TileScale && blends[ sourceID ] == 0.0 ) {
pixmaps[ destID ] = pixmaps[ sourceID ];
duplicate[ destID ] = true;
}
if ( !duplicate[ destID ] ) {
pixmaps[ destID ] = loadPixmap( pixnames[ destID ] );
if ( scaleHints[ destID ] == TileScale && blends[ destID ] == 0.0 )
images[ destID ] = NULL;
else
images[ destID ] = loadImage( pixnames[ destID ] );
}
}
// border pixmap
pbDuplicate[ destID ] = false;
pbPixmaps[ destID ] = NULL;
pbWidth[ destID ] = pbWidth[ sourceID ];
brdnames[ destID ] = brdnames[ sourceID ];
if ( !brdnames[ destID ].isEmpty() ) {
pbPixmaps[ destID ] = pbPixmaps[ sourceID ];
pbDuplicate[ destID ] = true;
}
if ( sourceID == ActiveTab && destID == InactiveTab )
aTabLine = iTabLine;
else if ( sourceID == InactiveTab && destID == ActiveTab )
iTabLine = aTabLine;
}
void OThemeBase::readConfig( Qt::GUIStyle /*style*/ )
{
#define PREBLEND_ITEMS 12
static WidgetType preBlend[] = {Slider, IndicatorOn, IndicatorOff,
ExIndicatorOn, ExIndicatorOff, HScrollDeco, VScrollDeco, HScrollDecoDown,
VScrollDecoDown, ComboDeco, ComboDecoDown, CheckMark};
int i;
QString tmpStr;
QString copyfrom[ WIDGETS ];
QString pixnames[ WIDGETS ]; // used for duplicate check
QString brdnames[ WIDGETS ];
bool loaded[ WIDGETS ]; // used for preloading for CopyWidget
if ( configFileName.isEmpty() ) {
Config cfg ( "qpe" );
cfg. setGroup ( "Appearance" );
configFileName = cfg. readEntry ( "Theme", "default" );
}
Config config( configFilePath + "/themes/" + configFileName + ".themerc" , Config::File );
// Are we initalized?
applyMiscResourceGroup( &config );
for ( i = 0; i < INHERIT_ITEMS; ++i ) {
applyResourceGroup( &config, i, copyfrom, pixnames, brdnames );
}
for ( ; i < INHERIT_ITEMS*2; ++i ) {
if ( config.hasGroup( QString( widgetEntries[ i ] ) ) ) {
applyResourceGroup( &config, i, copyfrom, pixnames, brdnames );
}
else {
copyfrom [ i ] = widgetEntries[ i - INHERIT_ITEMS ];
}
}
for ( ; i < WIDGETS; ++i ) {
applyResourceGroup( &config, i, copyfrom, pixnames, brdnames );
}
// initalize defaults that may not be read
for ( i = 0; i < WIDGETS; ++i )
loaded[ i ] = false;
btnXShift = btnYShift = focus3DOffset = 0;
aTabLine = iTabLine = true;
roundedButton = roundedCombo = roundedSlider = focus3D = false;
splitterWidth = 10;
for ( i = 0; i < WIDGETS; ++i ) {
readResourceGroup( i, copyfrom, pixnames, brdnames, loaded );
}
// misc items
readMiscResourceGroup();
// Handle preblend items
for ( i = 0; i < PREBLEND_ITEMS; ++i ) {
if ( pixmaps[ preBlend[ i ] ] != NULL && blends[ preBlend[ i ] ] != 0.0 )
blend( preBlend[ i ] );
}
}
OThemeBase::OThemeBase( const QString & configFile )
: QWindowsStyle()
{
- configFilePath = QPEApplication::qpeDir ( ) + "/plugins/styles/";
+ configFilePath = QPEApplication::qpeDir ( ) + "plugins/styles/";
configFileName = configFile;
readConfig( Qt::WindowsStyle );
cache = new OThemeCache( cacheSize );
}
void OThemeBase::applyConfigFile( const QString &/*file*/ )
{
#if 0
// handle std color scheme
Config inConfig( file, Config::File );
Config globalConfig ( "qpe" );
globalConfig. setGroup ( "Apperance" );
inConfig. setGroup( "General" );
if ( inConfig.hasKey( "foreground" ) )
globalConfig.writeEntry( "Text", inConfig.readEntry( "foreground", " " ) );
if ( inConfig.hasKey( "background" ) )
globalConfig.writeEntry( "Background", inConfig.readEntry( "background", " " ) );
if ( inConfig.hasKey( "selectForeground" ) )
globalConfig.writeEntry( "HighlightedText", inConfig.readEntry( "selectForeground", " " ) );
if ( inConfig.hasKey( "selectBackground" ) )
globalConfig.writeEntry( "Highlight", inConfig.readEntry( "selectBackground", " " ) );
if ( inConfig.hasKey( "windowForeground" ) )
globalConfig.writeEntry( "Text", inConfig.readEntry( "windowForeground", " " ) );
if ( inConfig.hasKey( "windowBackground" ) )
globalConfig.writeEntry( "Base", inConfig.readEntry( "windowBackground", " " ) );
// Keep track of the current theme so that we can select the right one
// in the KControl module.
globalConfig.writeEntry ( "CurrentTheme", file );
globalConfig.write();
#endif
}
OThemeBase::~OThemeBase()
{
int i;
for ( i = 0; i < WIDGETS; ++i ) {
if ( !duplicate[ i ] ) {
if ( images[ i ] )
delete images[ i ];
if ( pixmaps[ i ] )
delete pixmaps[ i ];
}
if ( !pbDuplicate[ i ] && pbPixmaps[ i ] )
delete pbPixmaps[ i ];
if ( colors[ i ] )
delete( colors[ i ] );
if ( grLowColors[ i ] )
delete( grLowColors[ i ] );
if ( grHighColors[ i ] )
delete( grHighColors[ i ] );
}
delete cache;
}
QImage* OThemeBase::loadImage( QString &name )
{
QImage * image = new QImage;
QString path = configFilePath + "/pixmaps/" + name;
image->load( path );
if ( !image->isNull() )
return ( image );
odebug << "OThemeBase: Unable to load image " << name.ascii ( ) << oendl;
delete image;
return ( NULL );
}
OThemePixmap* OThemeBase::loadPixmap( QString &name )
{
OThemePixmap * pixmap = new OThemePixmap( false );
QString path = configFilePath + "/pixmaps/" + name;
pixmap->load( path );
if ( !pixmap->isNull() )
return pixmap;
odebug << "OThemeBase: Unable to load pixmap " << name.ascii() << oendl;
delete pixmap;
return ( NULL );
}
OThemePixmap* OThemeBase::scale( int w, int h, WidgetType widget )
{
if ( scaleHints[ widget ] == FullScale ) {
if ( !pixmaps[ widget ] || pixmaps[ widget ] ->width() != w ||
pixmaps[ widget ] ->height() != h ) {
OThemePixmap * cachePix = cache->pixmap( w, h, widget );
if ( cachePix ) {
cachePix = new OThemePixmap( *cachePix );
if ( pixmaps[ widget ] )
cache->insert( pixmaps[ widget ], OThemeCache::FullScale,
widget );
else
odebug << "We would have inserted a null pixmap!\n" << oendl;
diff --git a/noncore/styles/theme/themeset.cpp b/noncore/styles/theme/themeset.cpp
index d4005bc..3205106 100644
--- a/noncore/styles/theme/themeset.cpp
+++ b/noncore/styles/theme/themeset.cpp
@@ -1,124 +1,124 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include "themeset.h"
#include <qpe/qpeapplication.h>
#include <qpe/global.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qlistview.h>
#include <qdir.h>
#include <qpe/config.h>
class MyConfig : public Config
{
public:
MyConfig ( const QString &f, Domain d ) : Config ( f, d )
{ }
bool hasGroup ( const QString &gname ) const
{
QMap< QString, ConfigGroup>::ConstIterator it = groups. find ( gname );
return ( it != groups.end() );
}
};
class MyItem : public QListViewItem
{
public:
MyItem ( QListView *lv, QListViewItem *after, const QString &name, const QString &comm, const QString &theme ) : QListViewItem ( lv, after, name, comm )
{
m_theme = theme;
}
QString m_theme;
};
ThemeSettings::ThemeSettings ( QWidget* parent, const char *name, WFlags fl )
: QWidget ( parent, name, fl )
{
setCaption ( tr( "Theme Style" ) );
Config config ( "qpe" );
config. setGroup ( "Appearance" );
QString active = config. readEntry ( "Theme", "default" );
QVBoxLayout *vbox = new QVBoxLayout ( this );
vbox-> setSpacing ( 3 );
vbox-> setMargin ( 6 );
vbox-> addWidget ( new QLabel ( tr( "Select the theme to be used" ), this ));
m_list = new QListView ( this );
m_list-> addColumn ( tr( "Name" ));
m_list-> addColumn ( tr( "Description" ));
m_list-> setSelectionMode ( QListView::Single );
m_list-> setAllColumnsShowFocus ( true );
m_list-> setSorting ( -1 );
vbox-> addWidget ( m_list, 10 );
QListViewItem *item = new MyItem ( m_list, 0, tr( "[No theme]" ), "", "" );
m_list-> setSelected ( item, true );
- QString path = QPEApplication::qpeDir() + "/plugins/styles/themes";
+ QString path = QPEApplication::qpeDir() + "plugins/styles/themes";
QStringList list = QDir ( path, "*.themerc" ). entryList ( );
for ( QStringList::Iterator it = list. begin(); it != list. end ( ); ++it ) {
MyConfig cfg ( path + "/" + *it, Config::File );
if ( cfg. hasGroup ( "Misc" )) {
cfg. setGroup ( "Misc" );
QString name = cfg. readEntry ( "Name" );
QString comm = cfg. readEntry ( "Comment" );
if ( !name. isEmpty ( )) {
QString fname = (*it). left ((*it). length ( ) - 8 );
item = new MyItem ( m_list, item, name, comm, fname );
if ( active == fname ) {
m_list-> setSelected ( item, true );
}
}
}
}
}
bool ThemeSettings::writeConfig ( )
{
Config config ( "qpe" );
config. setGroup ( "Appearance" );
MyItem *it = (MyItem *) m_list-> selectedItem ( );
config. writeEntry ( "Theme", it ? it-> m_theme : QString ( "" ));
config. write ( );
return true;
}
diff --git a/noncore/tools/calc2/calc.cpp b/noncore/tools/calc2/calc.cpp
index 3dcdf6e..c7656bf 100644
--- a/noncore/tools/calc2/calc.cpp
+++ b/noncore/tools/calc2/calc.cpp
@@ -1,104 +1,104 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include <qvaluelist.h>
#include <qpe/qpeapplication.h>
#include <qdir.h>
#include <qwidgetstack.h>
#include "calc.h"
#include "plugininterface.h"
calc::calc (QWidget * p, const char *n):QWidget (p, n)
{
setCaption (tr ("Calculator"));
// widgets
LCD = new QLCDNumber (this);
LCD->setMaximumSize (QSize (240, 30));
LCD->setNumDigits(12);
LCD->setSegmentStyle(QLCDNumber::Filled);
pluginWidgetStack = new QWidgetStack (this);
// layout widgets
calculatorLayout = new QVBoxLayout (this);
calculatorLayout->addWidget (LCD);
calculatorLayout->addWidget (pluginWidgetStack);
// no formatting of display for now
connect (&engine, SIGNAL(display(double)), LCD, SLOT(display(double)));
connect (&engine, SIGNAL(display(const QString&)), LCD, SLOT(display(const QString&)));
connect (&engine, SIGNAL(setBinMode()), LCD, SLOT(setBinMode()));
connect (&engine, SIGNAL(setOctMode()), LCD, SLOT(setOctMode()));
connect (&engine, SIGNAL(setDecMode()), LCD, SLOT(setDecMode()));
connect (&engine, SIGNAL(setHexMode()), LCD, SLOT(setHexMode()));
#ifndef NO_PLUGINS
// load plugins
QValueList < Plugin >::Iterator mit;
for (mit = pluginList.begin (); mit != pluginList.end (); ++mit) {
(*mit).interface->release ();
(*mit).library->unload ();
delete (*mit).library;
}
pluginList.clear ();
- QString path = QPEApplication::qpeDir() + "/plugins/calculator";
+ QString path = QPEApplication::qpeDir() + "plugins/calculator";
QDir dir (path, "lib*.so");
QStringList list = dir.entryList ();
QStringList::Iterator it;
for (it = list.begin (); it != list.end (); ++it) {
CalcInterface *iface = 0;
QLibrary *lib = new QLibrary (path + "/" + *it);
Plugin plugin;
plugin.pluginWidget = 0;
if (lib->queryInterface (IID_Calc, (QUnknownInterface **) & iface) ==
QS_OK) {
plugin.library = lib;
plugin.interface = iface;
plugin.pluginWidget = plugin.interface->getPlugin(&engine,pluginWidgetStack);
if (plugin.pluginWidget)
pluginWidgetStack->addWidget (plugin.pluginWidget, pluginList.count());
pluginList.append (plugin);
} else {
delete lib;
}
}
setMode (1);
#else
// load simple interface
#endif
}
calc::~calc ()
{
#ifndef NO_PLUGINS
QValueList < Plugin >::Iterator mit;
for (mit = pluginList.begin (); mit != pluginList.end (); ++mit) {
(*mit).interface->release ();
(*mit).library->unload ();
delete (*mit).library;
}
#endif
}