summaryrefslogtreecommitdiff
path: root/noncore/apps
Side-by-side diff
Diffstat (limited to 'noncore/apps') (more/less context) (ignore whitespace changes)
-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
7 files changed, 16 insertions, 16 deletions
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));
}