summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp2
-rw-r--r--noncore/apps/advancedfm/advancedfm.h7
-rw-r--r--noncore/apps/advancedfm/advancedfmData.cpp1
-rw-r--r--noncore/apps/advancedfm/advancedfmMenu.cpp6
-rw-r--r--noncore/apps/advancedfm/main.cpp19
-rw-r--r--noncore/apps/advancedfm/output.cpp8
-rw-r--r--noncore/apps/advancedfm/output.h6
-rw-r--r--noncore/apps/checkbook/checkbook.cpp1
-rw-r--r--noncore/apps/checkbook/checkbook.h3
-rw-r--r--noncore/apps/checkbook/main.cpp2
-rw-r--r--noncore/apps/checkbook/mainwindow.cpp2
-rw-r--r--noncore/apps/confedit/main.cpp3
-rw-r--r--noncore/apps/odict/main.cpp2
-rw-r--r--noncore/apps/odict/searchmethoddlg.cpp3
-rw-r--r--noncore/apps/opie-bartender/bartender.cpp2
-rw-r--r--noncore/apps/opie-console/io_bt.cpp4
-rw-r--r--noncore/apps/opie-console/io_bt.h4
-rw-r--r--noncore/apps/opie-console/io_irda.cpp4
-rw-r--r--noncore/apps/opie-console/io_irda.h4
-rw-r--r--noncore/apps/opie-console/io_modem.cpp2
-rw-r--r--noncore/apps/opie-console/io_modem.h2
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp5
-rw-r--r--noncore/apps/opie-console/profileeditordialog.cpp1
-rw-r--r--noncore/apps/opie-console/profileeditordialog.h2
-rw-r--r--noncore/apps/opie-console/sz_transfer.cpp8
-rw-r--r--noncore/apps/opie-console/sz_transfer.h6
-rw-r--r--noncore/apps/opie-console/tabwidget.cpp1
-rw-r--r--noncore/apps/opie-console/tabwidget.h2
-rw-r--r--noncore/apps/opie-console/test/senderui.cpp2
-rw-r--r--noncore/apps/opie-console/test/senderui.h4
-rw-r--r--noncore/apps/opie-console/transferdialog.cpp3
-rw-r--r--noncore/apps/opie-reader/QTReaderApp.cpp2
-rw-r--r--noncore/apps/opie-sheet/main.cpp3
-rw-r--r--noncore/apps/opie-write/main.cpp2
-rw-r--r--noncore/apps/oxygen/main.cpp2
-rw-r--r--noncore/apps/tableviewer/main.cpp2
-rw-r--r--noncore/apps/tableviewer/tableviewer.cpp2
-rw-r--r--noncore/apps/tinykate/libkate/view/kateviewdialog.cpp2
-rw-r--r--noncore/apps/tinykate/libkate/view/kateviewdialog.h2
-rw-r--r--noncore/apps/tinykate/main.cpp3
-rw-r--r--noncore/apps/tinykate/tinykate.cpp7
-rw-r--r--noncore/apps/tinykate/tinykate.h2
-rw-r--r--noncore/apps/zsafe/zsafe.cpp3
43 files changed, 90 insertions, 63 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index 2ba3dca..a60d6ce 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -1,227 +1,229 @@
1/*************************************************************************** 1/***************************************************************************
2 AdvancedFm.cpp 2 AdvancedFm.cpp
3 ------------------- 3 -------------------
4 ** Created: Sat Mar 9 23:33:09 2002 4 ** Created: Sat Mar 9 23:33:09 2002
5 copyright : (C) 2002 by ljp 5 copyright : (C) 2002 by ljp
6 email : ljp@llornkcor.com 6 email : ljp@llornkcor.com
7 * This program is free software; you can redistribute it and/or modify * 7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by * 8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or * 9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. * 10 * (at your option) any later version. *
11 ***************************************************************************/ 11 ***************************************************************************/
12#define DEVELOPERS_VERSION 12#define DEVELOPERS_VERSION
13#include "advancedfm.h" 13#include "advancedfm.h"
14 14
15#include <qpe/qpeapplication.h> 15#include <qpe/qpeapplication.h>
16#include <qpe/config.h> 16#include <qpe/config.h>
17#include <qpe/mimetype.h> 17#include <qpe/mimetype.h>
18#include <qpe/applnk.h> 18#include <qpe/applnk.h>
19#include <qpe/resource.h> 19#include <qpe/resource.h>
20#include <qpe/menubutton.h> 20#include <qpe/menubutton.h>
21 21
22#include <qcombobox.h> 22#include <qcombobox.h>
23#include <qpopupmenu.h> 23#include <qpopupmenu.h>
24#include <qlistview.h> 24#include <qlistview.h>
25#include <qmessagebox.h> 25#include <qmessagebox.h>
26#include <qlineedit.h> 26#include <qlineedit.h>
27 27
28 28
29#include <sys/stat.h> 29#include <sys/stat.h>
30#include <time.h> 30#include <time.h>
31#include <dirent.h> 31#include <dirent.h>
32#include <fcntl.h> 32#include <fcntl.h>
33#include <sys/vfs.h> 33#include <sys/vfs.h>
34#include <mntent.h> 34#include <mntent.h>
35 35
36using namespace Opie::Ui;
37
36#ifdef NOQUICKLAUNCH 38#ifdef NOQUICKLAUNCH
37AdvancedFm::AdvancedFm( ) 39AdvancedFm::AdvancedFm( )
38#else 40#else
39AdvancedFm::AdvancedFm(QWidget *,const char*, WFlags ) 41AdvancedFm::AdvancedFm(QWidget *,const char*, WFlags )
40#endif 42#endif
41 : QMainWindow( ) { 43 : QMainWindow( ) {
42 init(); 44 init();
43 renameBox = 0; 45 renameBox = 0;
44 46
45 unknownXpm = Resource::loadImage( "UnknownDocument" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); 47 unknownXpm = Resource::loadImage( "UnknownDocument" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() );
46 48
47 initConnections(); 49 initConnections();
48 whichTab=1; 50 whichTab=1;
49 rePopulate(); 51 rePopulate();
50 currentPathCombo->setFocus(); 52 currentPathCombo->setFocus();
51 channel = new QCopChannel( "QPE/Application/advancedfm", this ); 53 channel = new QCopChannel( "QPE/Application/advancedfm", this );
52 connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), 54 connect( channel, SIGNAL(received(const QCString&,const QByteArray&)),
53 this, SLOT( qcopReceive(const QCString&,const QByteArray&)) ); 55 this, SLOT( qcopReceive(const QCString&,const QByteArray&)) );
54} 56}
55 57
56AdvancedFm::~AdvancedFm() { 58AdvancedFm::~AdvancedFm() {
57} 59}
58 60
59 61
60void AdvancedFm::cleanUp() { 62void AdvancedFm::cleanUp() {
61 QString sfile=QDir::homeDirPath(); 63 QString sfile=QDir::homeDirPath();
62 if(sfile.right(1) != "/") 64 if(sfile.right(1) != "/")
63 sfile+="/._temp"; 65 sfile+="/._temp";
64 else 66 else
65 sfile+="._temp"; 67 sfile+="._temp";
66 QFile file( sfile); 68 QFile file( sfile);
67 if(file.exists()) 69 if(file.exists())
68 file.remove(); 70 file.remove();
69} 71}
70 72
71void AdvancedFm::tabChanged(QWidget *) { 73void AdvancedFm::tabChanged(QWidget *) {
72// qWarning("tab changed"); 74// qWarning("tab changed");
73 QString path = CurrentDir()->canonicalPath(); 75 QString path = CurrentDir()->canonicalPath();
74 currentPathCombo->lineEdit()->setText( path ); 76 currentPathCombo->lineEdit()->setText( path );
75 77
76 if(whichTab == 1) { 78 if(whichTab == 1) {
77 viewMenu->setItemChecked(viewMenu->idAt(0), true); 79 viewMenu->setItemChecked(viewMenu->idAt(0), true);
78 viewMenu->setItemChecked(viewMenu->idAt(1), false); 80 viewMenu->setItemChecked(viewMenu->idAt(1), false);
79 } else { 81 } else {
80 viewMenu->setItemChecked(viewMenu->idAt(0), false); 82 viewMenu->setItemChecked(viewMenu->idAt(0), false);
81 viewMenu->setItemChecked(viewMenu->idAt(1), true); 83 viewMenu->setItemChecked(viewMenu->idAt(1), true);
82 } 84 }
83 85
84 QString fs= getFileSystemType( (const QString &) path); 86 QString fs= getFileSystemType( (const QString &) path);
85 87
86 setCaption(tr("AdvancedFm :: ")+fs+" :: " 88 setCaption(tr("AdvancedFm :: ")+fs+" :: "
87 +checkDiskSpace( (const QString &) path )+ tr(" kB free") ); 89 +checkDiskSpace( (const QString &) path )+ tr(" kB free") );
88 chdir( path.latin1()); 90 chdir( path.latin1());
89} 91}
90 92
91 93
92void AdvancedFm::populateView() { 94void AdvancedFm::populateView() {
93 95
94// qWarning("PopulateView"); 96// qWarning("PopulateView");
95 QPixmap pm; 97 QPixmap pm;
96 QListView *thisView = CurrentView(); 98 QListView *thisView = CurrentView();
97 QDir *thisDir = CurrentDir(); 99 QDir *thisDir = CurrentDir();
98 QString path = thisDir->canonicalPath(); 100 QString path = thisDir->canonicalPath();
99 101
100//qWarning("path is "+path); 102//qWarning("path is "+path);
101 thisView->clear(); 103 thisView->clear();
102 thisDir->setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 104 thisDir->setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
103 thisDir->setMatchAllDirs(TRUE); 105 thisDir->setMatchAllDirs(TRUE);
104 thisDir->setNameFilter(filterStr); 106 thisDir->setNameFilter(filterStr);
105 QString fileL, fileS, fileDate; 107 QString fileL, fileS, fileDate;
106 QString fs= getFileSystemType((const QString &) path); 108 QString fs= getFileSystemType((const QString &) path);
107 setCaption(tr("AdvancedFm :: ")+fs+" :: " 109 setCaption(tr("AdvancedFm :: ")+fs+" :: "
108 +checkDiskSpace((const QString &) path)+ tr(" kB free") ); 110 +checkDiskSpace((const QString &) path)+ tr(" kB free") );
109 bool isDir=FALSE; 111 bool isDir=FALSE;
110 const QFileInfoList *list = thisDir->entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); 112 const QFileInfoList *list = thisDir->entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/);
111 QFileInfoListIterator it(*list); 113 QFileInfoListIterator it(*list);
112 QFileInfo *fi; 114 QFileInfo *fi;
113 while ( (fi=it.current()) ) { 115 while ( (fi=it.current()) ) {
114 if (fi->isSymLink() ) { 116 if (fi->isSymLink() ) {
115 QString symLink=fi->readLink(); 117 QString symLink=fi->readLink();
116 QFileInfo sym( symLink); 118 QFileInfo sym( symLink);
117 fileS.sprintf( "%10i", sym.size() ); 119 fileS.sprintf( "%10i", sym.size() );
118 fileL = fi->fileName() +" -> " + sym.filePath().data(); 120 fileL = fi->fileName() +" -> " + sym.filePath().data();
119 fileDate = sym.lastModified().toString(); 121 fileDate = sym.lastModified().toString();
120 } else { 122 } else {
121 fileS.sprintf( "%10i", fi->size() ); 123 fileS.sprintf( "%10i", fi->size() );
122 fileL = fi->fileName(); 124 fileL = fi->fileName();
123 fileDate= fi->lastModified().toString(); 125 fileDate= fi->lastModified().toString();
124 if( QDir(QDir::cleanDirPath( path +"/"+fileL)).exists() ) { 126 if( QDir(QDir::cleanDirPath( path +"/"+fileL)).exists() ) {
125// if(fileL == "..") 127// if(fileL == "..")
126 fileL += "/"; 128 fileL += "/";
127 isDir=TRUE; 129 isDir=TRUE;
128 } 130 }
129 } 131 }
130 QFileInfo fileInfo( path + "/" + fileL); 132 QFileInfo fileInfo( path + "/" + fileL);
131 133
132 if(fileL !="./" && fi->exists()) { 134 if(fileL !="./" && fi->exists()) {
133 item = new QListViewItem( thisView, fileL, fileS , fileDate); 135 item = new QListViewItem( thisView, fileL, fileS , fileDate);
134 136
135 if(isDir || fileL.find("/",0,TRUE) != -1) { 137 if(isDir || fileL.find("/",0,TRUE) != -1) {
136 138
137 if( !QDir( fi->filePath() ).isReadable()) //is directory 139 if( !QDir( fi->filePath() ).isReadable()) //is directory
138 pm = Resource::loadPixmap( "lockedfolder" ); 140 pm = Resource::loadPixmap( "lockedfolder" );
139 else 141 else
140 pm= Resource::loadPixmap( "folder" ); 142 pm= Resource::loadPixmap( "folder" );
141 } 143 }
142 else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { 144 else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) {
143 pm = Resource::loadPixmap( "exec"); 145 pm = Resource::loadPixmap( "exec");
144 } 146 }
145 else if( (fileInfo.permission( QFileInfo::ExeUser) 147 else if( (fileInfo.permission( QFileInfo::ExeUser)
146 | fileInfo.permission( QFileInfo::ExeGroup) 148 | fileInfo.permission( QFileInfo::ExeGroup)
147 | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { 149 | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) {
148 pm = Resource::loadPixmap( "exec"); 150 pm = Resource::loadPixmap( "exec");
149 } 151 }
150 else if( !fi->isReadable() ) { 152 else if( !fi->isReadable() ) {
151 pm = Resource::loadPixmap( "locked" ); 153 pm = Resource::loadPixmap( "locked" );
152 } 154 }
153 else { //everything else goes by mimetype 155 else { //everything else goes by mimetype
154 MimeType mt(fi->filePath()); 156 MimeType mt(fi->filePath());
155 pm=mt.pixmap(); //sets the correct pixmap for mimetype 157 pm=mt.pixmap(); //sets the correct pixmap for mimetype
156 if(pm.isNull()) { 158 if(pm.isNull()) {
157 pm = unknownXpm; 159 pm = unknownXpm;
158 } 160 }
159 } 161 }
160 if( fi->isSymLink() || fileL.find("->",0,TRUE) != -1) { 162 if( fi->isSymLink() || fileL.find("->",0,TRUE) != -1) {
161 // qDebug(" overlay link image"); 163 // qDebug(" overlay link image");
162 pm= Resource::loadPixmap( "advancedfm/symlink" ); 164 pm= Resource::loadPixmap( "advancedfm/symlink" );
163 // pm= Resource::loadPixmap( "folder" ); 165 // pm= Resource::loadPixmap( "folder" );
164// QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); 166// QPixmap lnk = Resource::loadPixmap( "opie/symlink" );
165// QPainter painter( &pm ); 167// QPainter painter( &pm );
166// painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); 168// painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk );
167// pm.setMask( pm.createHeuristicMask( FALSE ) ); 169// pm.setMask( pm.createHeuristicMask( FALSE ) );
168 } 170 }
169 item->setPixmap( 0,pm); 171 item->setPixmap( 0,pm);
170 172
171 } 173 }
172 isDir=FALSE; 174 isDir=FALSE;
173 ++it; 175 ++it;
174 } 176 }
175 177
176 if( path.find("dev",0,TRUE) != -1) { 178 if( path.find("dev",0,TRUE) != -1) {
177 struct stat buf; 179 struct stat buf;
178 dev_t devT; 180 dev_t devT;
179 DIR *dir; 181 DIR *dir;
180 struct dirent *mydirent; 182 struct dirent *mydirent;
181 183
182 if((dir = opendir( path.latin1())) != NULL) 184 if((dir = opendir( path.latin1())) != NULL)
183 while ((mydirent = readdir(dir)) != NULL) { 185 while ((mydirent = readdir(dir)) != NULL) {
184 lstat( mydirent->d_name, &buf); 186 lstat( mydirent->d_name, &buf);
185// qDebug(mydirent->d_name); 187// qDebug(mydirent->d_name);
186 fileL.sprintf("%s", mydirent->d_name); 188 fileL.sprintf("%s", mydirent->d_name);
187 devT = buf.st_dev; 189 devT = buf.st_dev;
188 fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); 190 fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF);
189 fileDate.sprintf("%s", ctime( &buf.st_mtime)); 191 fileDate.sprintf("%s", ctime( &buf.st_mtime));
190 if( fileL.find(".") == -1 ) { 192 if( fileL.find(".") == -1 ) {
191 item= new QListViewItem( thisView, fileL, fileS, fileDate); 193 item= new QListViewItem( thisView, fileL, fileS, fileDate);
192 pm = unknownXpm; 194 pm = unknownXpm;
193 item->setPixmap( 0,pm); 195 item->setPixmap( 0,pm);
194 } 196 }
195 } 197 }
196 198
197 closedir(dir); 199 closedir(dir);
198 } 200 }
199 201
200 thisView->setSorting( 3,FALSE); 202 thisView->setSorting( 3,FALSE);
201 fillCombo( (const QString &) path ); 203 fillCombo( (const QString &) path );
202} 204}
203 205
204void AdvancedFm::rePopulate() { 206void AdvancedFm::rePopulate() {
205 populateView(); 207 populateView();
206 setOtherTabCurrent(); 208 setOtherTabCurrent();
207 populateView(); 209 populateView();
208 210
209// int tmpTab = whichTab; 211// int tmpTab = whichTab;
210// // qDebug("%d", tmpTab); 212// // qDebug("%d", tmpTab);
211 213
212// for(int i =1; i < 3; i++) { 214// for(int i =1; i < 3; i++) {
213// TabWidget->setCurrentWidget(i - 1); 215// TabWidget->setCurrentWidget(i - 1);
214// populateView(); 216// populateView();
215// } 217// }
216// TabWidget->setCurrentWidget( tmpTab - 1); 218// TabWidget->setCurrentWidget( tmpTab - 1);
217} 219}
218 220
219void AdvancedFm::ListClicked(QListViewItem *selectedItem) { 221void AdvancedFm::ListClicked(QListViewItem *selectedItem) {
220//qWarning("listclicked"); 222//qWarning("listclicked");
221 if(selectedItem) { 223 if(selectedItem) {
222 QString strItem=selectedItem->text(0); 224 QString strItem=selectedItem->text(0);
223// qWarning(strItem); 225// qWarning(strItem);
224 QString strSize=selectedItem->text(1); 226 QString strSize=selectedItem->text(1);
225 strSize=strSize.stripWhiteSpace(); 227 strSize=strSize.stripWhiteSpace();
226 bool isDirectory = false; 228 bool isDirectory = false;
227 QString strItem2; 229 QString strItem2;
diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h
index 547fa7c..4eaa6d6 100644
--- a/noncore/apps/advancedfm/advancedfm.h
+++ b/noncore/apps/advancedfm/advancedfm.h
@@ -1,192 +1,191 @@
1/*************************************************************************** 1/***************************************************************************
2 advancedfm.h 2 advancedfm.h
3 ------------------- 3 -------------------
4 ** Created: Sat Mar 9 23:33:09 2002 4 ** Created: Sat Mar 9 23:33:09 2002
5 copyright : (C) 2002 by ljp 5 copyright : (C) 2002 by ljp
6 email : ljp@llornkcor.com 6 email : ljp@llornkcor.com
7 * This program is free software; you can redistribute it and/or modify * 7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by * 8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or * 9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. * 10 * (at your option) any later version. *
11 ***************************************************************************/ 11 ***************************************************************************/
12#ifndef ADVANCEDFM_H 12#ifndef ADVANCEDFM_H
13#define ADVANCEDFM_H 13#define ADVANCEDFM_H
14#define QTOPIA_INTERNAL_FSLP // to get access to fileproperties 14#define QTOPIA_INTERNAL_FSLP // to get access to fileproperties
15#define QT_QWS_OPIE 15#define QT_QWS_OPIE
16 16
17#include <opie2/oprocess.h> 17#include <opie2/oprocess.h>
18#include <opie2/osplitter.h> 18#include <opie2/osplitter.h>
19 19
20#include <qpe/ir.h> 20#include <qpe/ir.h>
21#include <qpe/qcopenvelope_qws.h> 21#include <qpe/qcopenvelope_qws.h>
22 22
23#include <qvariant.h> 23#include <qvariant.h>
24#include <qdialog.h> 24#include <qdialog.h>
25#include <qmainwindow.h> 25#include <qmainwindow.h>
26#include <qstringlist.h> 26#include <qstringlist.h>
27#include <qdir.h> 27#include <qdir.h>
28#include <qstring.h> 28#include <qstring.h>
29#include <qpoint.h> 29#include <qpoint.h>
30#include <qtimer.h> 30#include <qtimer.h>
31#include <qpixmap.h> 31#include <qpixmap.h>
32 32
33using Opie::OSplitter;
34 33
35class QVBoxLayout; 34class QVBoxLayout;
36class QHBoxLayout; 35class QHBoxLayout;
37class QGridLayout; 36class QGridLayout;
38class QComboBox; 37class QComboBox;
39class QListView; 38class QListView;
40class QListviewItem; 39class QListviewItem;
41class QLabel; 40class QLabel;
42class QProgressBar; 41class QProgressBar;
43class QSpinBox; 42class QSpinBox;
44class QWidget; 43class QWidget;
45class QPopupMenu; 44class QPopupMenu;
46class QFile; 45class QFile;
47class QListViewItem; 46class QListViewItem;
48class QLineEdit; 47class QLineEdit;
49class MenuButton; 48class MenuButton;
50 49
51class QToolButton; 50class QToolButton;
52class Ir; 51class Ir;
53 52
54class AdvancedFm : public QMainWindow 53class AdvancedFm : public QMainWindow
55{ 54{
56 Q_OBJECT 55 Q_OBJECT
57public: 56public:
58 static QString appName() { return QString::fromLatin1("advancedfm"); } 57 static QString appName() { return QString::fromLatin1("advancedfm"); }
59#ifdef NOQUICKLAUNCH 58#ifdef NOQUICKLAUNCH
60 AdvancedFm(); 59 AdvancedFm();
61#else 60#else
62 AdvancedFm(QWidget *p = 0, const char* name = 0, WFlags fl = 0); 61 AdvancedFm(QWidget *p = 0, const char* name = 0, WFlags fl = 0);
63#endif 62#endif
64 ~AdvancedFm(); 63 ~AdvancedFm();
65protected slots: 64protected slots:
66 void slotSwitchMenu(int); 65 void slotSwitchMenu(int);
67 void selectAll(); 66 void selectAll();
68 void addToDocs(); 67 void addToDocs();
69 void doDirChange(); 68 void doDirChange();
70 void mkDir(); 69 void mkDir();
71 void del(); 70 void del();
72 void rn(); 71 void rn();
73 void populateView(); 72 void populateView();
74 void rePopulate(); 73 void rePopulate();
75 void showHidden(); 74 void showHidden();
76 void showMenuHidden(); 75 void showMenuHidden();
77 void writeConfig(); 76 void writeConfig();
78 void readConfig(); 77 void readConfig();
79 void ListClicked(QListViewItem *); 78 void ListClicked(QListViewItem *);
80 void ListPressed( int, QListViewItem *, const QPoint&, int); 79 void ListPressed( int, QListViewItem *, const QPoint&, int);
81 void makeDir(); 80 void makeDir();
82 void doDelete(); 81 void doDelete();
83 void tabChanged(QWidget*); 82 void tabChanged(QWidget*);
84 void cleanUp(); 83 void cleanUp();
85 void renameIt(); 84 void renameIt();
86 void runThis(); 85 void runThis();
87 void runText(); 86 void runText();
88 void filePerms(); 87 void filePerms();
89 void doProperties(); 88 void doProperties();
90 void runCommand(); 89 void runCommand();
91 void runCommandStd(); 90 void runCommandStd();
92 QStringList getPath(); 91 QStringList getPath();
93 void mkSym(); 92 void mkSym();
94 void switchToLocalTab(); 93 void switchToLocalTab();
95 void switchToRemoteTab(); 94 void switchToRemoteTab();
96 95
97protected: 96protected:
98 97
99 OSplitter *TabWidget; 98 Opie::Ui::OSplitter *TabWidget;
100 QCopChannel * channel; 99 QCopChannel * channel;
101 QPixmap unknownXpm; 100 QPixmap unknownXpm;
102 int whichTab; 101 int whichTab;
103// QTabWidget *TabWidget; 102// QTabWidget *TabWidget;
104 QWidget *tab, *tab_2, *tab_3; 103 QWidget *tab, *tab_2, *tab_3;
105 QListView *Local_View, *Remote_View; 104 QListView *Local_View, *Remote_View;
106 105
107 QLineEdit *currentPathEdit; 106 QLineEdit *currentPathEdit;
108 QPopupMenu *fileMenu, *localMenu, *remoteMenu, *viewMenu /*, *customDirMenu*/; 107 QPopupMenu *fileMenu, *localMenu, *remoteMenu, *viewMenu /*, *customDirMenu*/;
109 QToolButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; 108 QToolButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton;
110// QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; 109// QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton;
111 QDir currentDir, currentRemoteDir; 110 QDir currentDir, currentRemoteDir;
112 QComboBox *currentPathCombo; 111 QComboBox *currentPathCombo;
113 QString filterStr, s_addBookmark, s_removeBookmark; 112 QString filterStr, s_addBookmark, s_removeBookmark;
114 QListViewItem * item; 113 QListViewItem * item;
115 bool b; 114 bool b;
116 QStringList fileSystemTypeList, fsList; 115 QStringList fileSystemTypeList, fsList;
117 int currentServerConfig; 116 int currentServerConfig;
118 bool zaurusDevice; 117 bool zaurusDevice;
119 QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3; 118 QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3;
120 QStringList remoteDirPathStringList, localDirPathStringList; 119 QStringList remoteDirPathStringList, localDirPathStringList;
121 QLineEdit *renameBox; 120 QLineEdit *renameBox;
122 121
123 void init(); 122 void init();
124 void initConnections(); 123 void initConnections();
125 void keyReleaseEvent( QKeyEvent *); 124 void keyReleaseEvent( QKeyEvent *);
126 void keyPressEvent( QKeyEvent *); 125 void keyPressEvent( QKeyEvent *);
127 QString getFileSystemType(const QString &); 126 QString getFileSystemType(const QString &);
128 QString getDiskSpace(const QString &); 127 QString getDiskSpace(const QString &);
129 void parsetab(const QString &fileName); 128 void parsetab(const QString &fileName);
130 QString checkDiskSpace(const QString &); 129 QString checkDiskSpace(const QString &);
131 QString dealWithSymName(const QString &); 130 QString dealWithSymName(const QString &);
132 QDir *CurrentDir(); 131 QDir *CurrentDir();
133 QDir *OtherDir(); 132 QDir *OtherDir();
134 QListView *CurrentView(); 133 QListView *CurrentView();
135 QListView *OtherView(); 134 QListView *OtherView();
136 void setOtherTabCurrent(); 135 void setOtherTabCurrent();
137 void dealWithSchmooSchmaa(QWidget *); 136 void dealWithSchmooSchmaa(QWidget *);
138 137
139protected slots: 138protected slots:
140 void openSearch(); 139 void openSearch();
141 void dirMenuSelected(int); 140 void dirMenuSelected(int);
142 void showFileMenu(); 141 void showFileMenu();
143 void cancelMenuTimer(); 142 void cancelMenuTimer();
144 void homeButtonPushed(); 143 void homeButtonPushed();
145 void docButtonPushed(); 144 void docButtonPushed();
146 void SDButtonPushed(); 145 void SDButtonPushed();
147 void CFButtonPushed(); 146 void CFButtonPushed();
148 void QPEButtonPushed(); 147 void QPEButtonPushed();
149 void upDir(); 148 void upDir();
150 void currentPathComboChanged(); 149 void currentPathComboChanged();
151 void copy(); 150 void copy();
152 void copyAs(); 151 void copyAs();
153 void copySameDir(); 152 void copySameDir();
154 void currentPathComboActivated(const QString &); 153 void currentPathComboActivated(const QString &);
155 void fillCombo(const QString &); 154 void fillCombo(const QString &);
156 bool copyFile( const QString & , const QString & ); 155 bool copyFile( const QString & , const QString & );
157 void move(); 156 void move();
158 void fileStatus(); 157 void fileStatus();
159 void doAbout(); 158 void doAbout();
160 void doBeam(); 159 void doBeam();
161 void fileBeamFinished( Ir *); 160 void fileBeamFinished( Ir *);
162 bool copyDirectory( const QString & , const QString & ); 161 bool copyDirectory( const QString & , const QString & );
163// void navigateToSelected(); 162// void navigateToSelected();
164 bool moveDirectory( const QString & , const QString & ); 163 bool moveDirectory( const QString & , const QString & );
165// void slotSwitchtoLocal(int); 164// void slotSwitchtoLocal(int);
166 165
167private: 166private:
168 MenuButton *menuButton; 167 MenuButton *menuButton;
169 QString oldName; 168 QString oldName;
170 QTimer menuTimer; 169 QTimer menuTimer;
171 void startProcess(const QString &); 170 void startProcess(const QString &);
172 bool eventFilter( QObject * , QEvent * ); 171 bool eventFilter( QObject * , QEvent * );
173 void cancelRename(); 172 void cancelRename();
174 void doRename(QListView *); 173 void doRename(QListView *);
175 void okRename(); 174 void okRename();
176 void customDirsToMenu(); 175 void customDirsToMenu();
177 void addCustomDir(); 176 void addCustomDir();
178 void removeCustomDir(); 177 void removeCustomDir();
179 void gotoDirectory(const QString &); 178 void gotoDirectory(const QString &);
180 void navigateToSelected(); 179 void navigateToSelected();
181 void findFile(const QString &); 180 void findFile(const QString &);
182 181
183private slots: 182private slots:
184 void processEnded(OProcess *); 183 void processEnded(Opie::Core::OProcess *);
185 void oprocessStderr(OProcess *, char *, int); 184 void oprocessStderr(Opie::Core::OProcess *, char *, int);
186 void gotoCustomDir(const QString &); 185 void gotoCustomDir(const QString &);
187 void qcopReceive(const QCString&, const QByteArray&); 186 void qcopReceive(const QCString&, const QByteArray&);
188 void setDocument(const QString &); 187 void setDocument(const QString &);
189 188
190}; 189};
191 190
192#endif // ADVANCEDFM_H 191#endif // ADVANCEDFM_H
diff --git a/noncore/apps/advancedfm/advancedfmData.cpp b/noncore/apps/advancedfm/advancedfmData.cpp
index f791c77..73ef8f9 100644
--- a/noncore/apps/advancedfm/advancedfmData.cpp
+++ b/noncore/apps/advancedfm/advancedfmData.cpp
@@ -1,221 +1,222 @@
1/*************************************************************************** 1/***************************************************************************
2 advancedfmData.cpp 2 advancedfmData.cpp
3 ------------------- 3 -------------------
4** Created: Mon 09-23-2002 13:24:11 4** Created: Mon 09-23-2002 13:24:11
5 copyright : (C) 2002 by ljp 5 copyright : (C) 2002 by ljp
6 email : ljp@llornkcor.com 6 email : ljp@llornkcor.com
7 * This program is free software; you can redistribute it and/or modify * 7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by * 8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or * 9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. * 10 * (at your option) any later version. *
11 ***************************************************************************/ 11 ***************************************************************************/
12#include "advancedfm.h" 12#include "advancedfm.h"
13 13
14#include <qpe/storage.h> 14#include <qpe/storage.h>
15#include <qpe/qpeapplication.h> 15#include <qpe/qpeapplication.h>
16#include <qpe/resource.h> 16#include <qpe/resource.h>
17#include <qpe/menubutton.h> 17#include <qpe/menubutton.h>
18 18
19#include <qlayout.h> 19#include <qlayout.h>
20#include <qhbox.h> 20#include <qhbox.h>
21#include <qmenubar.h> 21#include <qmenubar.h>
22#include <qcombobox.h> 22#include <qcombobox.h>
23#include <qtoolbutton.h> 23#include <qtoolbutton.h>
24#include <qlineedit.h> 24#include <qlineedit.h>
25#include <qlistview.h> 25#include <qlistview.h>
26 26
27#include <sys/utsname.h> 27#include <sys/utsname.h>
28 28
29 29
30using namespace Opie::Ui;
30void AdvancedFm::init() { 31void AdvancedFm::init() {
31#if defined(QT_QWS_OPIE) 32#if defined(QT_QWS_OPIE)
32 qDebug("<<<<<<<<<<<<<<<<<<<<<<<< OPIE!!!"); 33 qDebug("<<<<<<<<<<<<<<<<<<<<<<<< OPIE!!!");
33#endif 34#endif
34 setCaption( tr( "AdvancedFm" ) ); 35 setCaption( tr( "AdvancedFm" ) );
35 36
36 QVBoxLayout *layout = new QVBoxLayout( this ); 37 QVBoxLayout *layout = new QVBoxLayout( this );
37 layout->setSpacing( 2); 38 layout->setSpacing( 2);
38 layout->setMargin( 2); 39 layout->setMargin( 2);
39 40
40 QMenuBar *menuBar = new QMenuBar(this); 41 QMenuBar *menuBar = new QMenuBar(this);
41 fileMenu = new QPopupMenu( this ); 42 fileMenu = new QPopupMenu( this );
42 viewMenu = new QPopupMenu( this ); 43 viewMenu = new QPopupMenu( this );
43// customDirMenu = new QPopupMenu( this ); 44// customDirMenu = new QPopupMenu( this );
44 45
45 layout->addWidget( menuBar ); 46 layout->addWidget( menuBar );
46 47
47 menuBar->insertItem( tr( "File" ), fileMenu); 48 menuBar->insertItem( tr( "File" ), fileMenu);
48 menuBar->insertItem( tr( "View" ), viewMenu); 49 menuBar->insertItem( tr( "View" ), viewMenu);
49 50
50 cdUpButton = new QToolButton( 0,"cdUpButton"); 51 cdUpButton = new QToolButton( 0,"cdUpButton");
51 cdUpButton->setPixmap(Resource::loadPixmap("up")); 52 cdUpButton->setPixmap(Resource::loadPixmap("up"));
52 cdUpButton->setAutoRaise( true ); 53 cdUpButton->setAutoRaise( true );
53 menuBar->insertItem( cdUpButton ); 54 menuBar->insertItem( cdUpButton );
54 55
55 56
56 QHBox *lineBox = new QHBox( this ); 57 QHBox *lineBox = new QHBox( this );
57 58
58 qpeDirButton= new QToolButton( 0,"QPEButton"); 59 qpeDirButton= new QToolButton( 0,"QPEButton");
59 qpeDirButton->setPixmap( Resource::loadPixmap("launcher/opielogo16x16"));//,"",this,"QPEButton"); 60 qpeDirButton->setPixmap( Resource::loadPixmap("launcher/opielogo16x16"));//,"",this,"QPEButton");
60 qpeDirButton->setAutoRaise( true ); 61 qpeDirButton->setAutoRaise( true );
61 menuBar->insertItem( qpeDirButton ); 62 menuBar->insertItem( qpeDirButton );
62 63
63 cfButton = new QToolButton( 0, "CFButton"); 64 cfButton = new QToolButton( 0, "CFButton");
64 cfButton->setPixmap(Resource::loadPixmap("cardmon/pcmcia")); 65 cfButton->setPixmap(Resource::loadPixmap("cardmon/pcmcia"));
65 cfButton->setAutoRaise( true ); 66 cfButton->setAutoRaise( true );
66 menuBar->insertItem( cfButton ); 67 menuBar->insertItem( cfButton );
67 68
68 sdButton = new QToolButton( 0, "SDButton"); 69 sdButton = new QToolButton( 0, "SDButton");
69 sdButton->setPixmap(Resource::loadPixmap("advancedfm/sdcard")); 70 sdButton->setPixmap(Resource::loadPixmap("advancedfm/sdcard"));
70 sdButton->setAutoRaise( true ); 71 sdButton->setAutoRaise( true );
71 menuBar->insertItem( sdButton ); 72 menuBar->insertItem( sdButton );
72 73
73 docButton = new QToolButton( 0,"docsButton"); 74 docButton = new QToolButton( 0,"docsButton");
74 docButton->setPixmap(Resource::loadPixmap("DocsIcon")); 75 docButton->setPixmap(Resource::loadPixmap("DocsIcon"));
75 docButton->setAutoRaise( true ); 76 docButton->setAutoRaise( true );
76 menuBar->insertItem( docButton ); 77 menuBar->insertItem( docButton );
77 78
78 homeButton = new QToolButton( 0, "homeButton"); 79 homeButton = new QToolButton( 0, "homeButton");
79 homeButton->setPixmap(Resource::loadPixmap("home")); 80 homeButton->setPixmap(Resource::loadPixmap("home"));
80 homeButton->setAutoRaise( true ); 81 homeButton->setAutoRaise( true );
81 menuBar->insertItem( homeButton ); 82 menuBar->insertItem( homeButton );
82 83
83 fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showMenuHidden() )); 84 fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showMenuHidden() ));
84 fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); 85 fileMenu->setItemChecked( fileMenu->idAt(0),TRUE);
85 fileMenu->insertSeparator(); 86 fileMenu->insertSeparator();
86 fileMenu->insertItem( tr( "File Search" ), this, SLOT( openSearch() )); 87 fileMenu->insertItem( tr( "File Search" ), this, SLOT( openSearch() ));
87 fileMenu->insertSeparator(); 88 fileMenu->insertSeparator();
88 fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() )); 89 fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() ));
89 fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() )); 90 fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() ));
90 fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() )); 91 fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() ));
91 fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() )); 92 fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() ));
92 fileMenu->insertSeparator(); 93 fileMenu->insertSeparator();
93 fileMenu->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); 94 fileMenu->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() ));
94 fileMenu->insertItem( tr( "Select All" ), this, SLOT( selectAll() )); 95 fileMenu->insertItem( tr( "Select All" ), this, SLOT( selectAll() ));
95 fileMenu->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() )); 96 fileMenu->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() ));
96 fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() )); 97 fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() ));
97 fileMenu->setCheckable(TRUE); 98 fileMenu->setCheckable(TRUE);
98 99
99 viewMenu->insertItem( tr( "Switch to View 1" ), this, SLOT( switchToLocalTab())); 100 viewMenu->insertItem( tr( "Switch to View 1" ), this, SLOT( switchToLocalTab()));
100 viewMenu->insertItem( tr( "Switch to View 2" ), this, SLOT( switchToRemoteTab())); 101 viewMenu->insertItem( tr( "Switch to View 2" ), this, SLOT( switchToRemoteTab()));
101// viewMenu->insertSeparator(); 102// viewMenu->insertSeparator();
102// viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); 103// viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() ));
103 viewMenu->setCheckable(true); 104 viewMenu->setCheckable(true);
104 viewMenu->setItemChecked( viewMenu->idAt(0), true); 105 viewMenu->setItemChecked( viewMenu->idAt(0), true);
105 viewMenu->setItemChecked( viewMenu->idAt(1), false); 106 viewMenu->setItemChecked( viewMenu->idAt(1), false);
106 107
107 s_addBookmark = tr("Bookmark Directory"); 108 s_addBookmark = tr("Bookmark Directory");
108 s_removeBookmark = tr("Remove Current Directory from Bookmarks"); 109 s_removeBookmark = tr("Remove Current Directory from Bookmarks");
109 110
110// menuButton->insertItem(""); 111// menuButton->insertItem("");
111 112
112// customDirMenu->insertItem(tr("Add This Directory")); 113// customDirMenu->insertItem(tr("Add This Directory"));
113// customDirMenu->insertItem(tr("Remove This Directory")); 114// customDirMenu->insertItem(tr("Remove This Directory"));
114// customDirMenu->insertSeparator(); 115// customDirMenu->insertSeparator();
115 116
116 menuButton = new MenuButton( lineBox ); 117 menuButton = new MenuButton( lineBox );
117 118
118 menuButton->setUseLabel(false); 119 menuButton->setUseLabel(false);
119 menuButton->setMaximumWidth( 20 ); 120 menuButton->setMaximumWidth( 20 );
120 menuButton->insertItem( s_addBookmark); 121 menuButton->insertItem( s_addBookmark);
121 menuButton->insertItem( s_removeBookmark); 122 menuButton->insertItem( s_removeBookmark);
122 menuButton->insertSeparator(); 123 menuButton->insertSeparator();
123 menuButton->setFocusPolicy(NoFocus); 124 menuButton->setFocusPolicy(NoFocus);
124 125
125 customDirsToMenu(); 126 customDirsToMenu();
126 127
127 currentPathCombo = new QComboBox( FALSE, lineBox, "currentPathCombo" ); 128 currentPathCombo = new QComboBox( FALSE, lineBox, "currentPathCombo" );
128 currentPathCombo->setEditable(TRUE); 129 currentPathCombo->setEditable(TRUE);
129 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); 130 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
130 currentPathCombo->setFocusPolicy(NoFocus); 131 currentPathCombo->setFocusPolicy(NoFocus);
131 layout->addWidget( lineBox ); 132 layout->addWidget( lineBox );
132 133
133 134
134 TabWidget = new OSplitter( Horizontal, this, "TabWidget" ); 135 TabWidget = new OSplitter( Horizontal, this, "TabWidget" );
135// TabWidget = new QTabWidget( this, "TabWidget" ); 136// TabWidget = new QTabWidget( this, "TabWidget" );
136 layout->addWidget( TabWidget, 4 ); 137 layout->addWidget( TabWidget, 4 );
137 138
138 tab = new QWidget( TabWidget, "tab" ); 139 tab = new QWidget( TabWidget, "tab" );
139 tabLayout = new QGridLayout( tab ); 140 tabLayout = new QGridLayout( tab );
140 tabLayout->setSpacing( 2); 141 tabLayout->setSpacing( 2);
141 tabLayout->setMargin( 2); 142 tabLayout->setMargin( 2);
142 143
143 Local_View = new QListView( tab, "Local_View" ); 144 Local_View = new QListView( tab, "Local_View" );
144 Local_View->addColumn( tr("File"),130); 145 Local_View->addColumn( tr("File"),130);
145 Local_View->addColumn( tr("Size"),-1); 146 Local_View->addColumn( tr("Size"),-1);
146 Local_View->setColumnAlignment(1,QListView::AlignRight); 147 Local_View->setColumnAlignment(1,QListView::AlignRight);
147 Local_View->addColumn( tr("Date"),-1); 148 Local_View->addColumn( tr("Date"),-1);
148 Local_View->setColumnAlignment(2,QListView::AlignRight); 149 Local_View->setColumnAlignment(2,QListView::AlignRight);
149 Local_View->setAllColumnsShowFocus(TRUE); 150 Local_View->setAllColumnsShowFocus(TRUE);
150 Local_View->setMultiSelection( TRUE ); 151 Local_View->setMultiSelection( TRUE );
151 Local_View->setSelectionMode(QListView::Extended); 152 Local_View->setSelectionMode(QListView::Extended);
152 Local_View->setFocusPolicy(StrongFocus); 153 Local_View->setFocusPolicy(StrongFocus);
153 Local_View->installEventFilter( this ); 154 Local_View->installEventFilter( this );
154 155
155 QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); 156 QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold);
156 157
157 tabLayout->addWidget( Local_View, 0, 0 ); 158 tabLayout->addWidget( Local_View, 0, 0 );
158 159
159 TabWidget->addWidget( tab,"advancedfm/smFileBrowser.png", tr("1")); 160 TabWidget->addWidget( tab,"advancedfm/smFileBrowser.png", tr("1"));
160// TabWidget->insertTab( tab, tr("1")); 161// TabWidget->insertTab( tab, tr("1"));
161 162
162 tab_2 = new QWidget( TabWidget, "tab_2" ); 163 tab_2 = new QWidget( TabWidget, "tab_2" );
163 tabLayout_2 = new QGridLayout( tab_2 ); 164 tabLayout_2 = new QGridLayout( tab_2 );
164 tabLayout_2->setSpacing( 2); 165 tabLayout_2->setSpacing( 2);
165 tabLayout_2->setMargin( 2); 166 tabLayout_2->setMargin( 2);
166 167
167 Remote_View = new QListView( tab_2, "Remote_View" ); 168 Remote_View = new QListView( tab_2, "Remote_View" );
168 Remote_View->addColumn( tr("File"),130); 169 Remote_View->addColumn( tr("File"),130);
169 Remote_View->addColumn( tr("Size"),-1); 170 Remote_View->addColumn( tr("Size"),-1);
170 Remote_View->setColumnAlignment(1,QListView::AlignRight); 171 Remote_View->setColumnAlignment(1,QListView::AlignRight);
171 Remote_View->addColumn( tr("Date"),-1); 172 Remote_View->addColumn( tr("Date"),-1);
172 Remote_View->setColumnAlignment(2,QListView::AlignRight); 173 Remote_View->setColumnAlignment(2,QListView::AlignRight);
173 Remote_View->setAllColumnsShowFocus(TRUE); 174 Remote_View->setAllColumnsShowFocus(TRUE);
174 Remote_View->setMultiSelection( TRUE ); 175 Remote_View->setMultiSelection( TRUE );
175 Remote_View->setSelectionMode(QListView::Extended); 176 Remote_View->setSelectionMode(QListView::Extended);
176 Remote_View->setFocusPolicy(StrongFocus); 177 Remote_View->setFocusPolicy(StrongFocus);
177 Remote_View->installEventFilter( this ); 178 Remote_View->installEventFilter( this );
178 179
179 QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); 180 QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold);
180 181
181 tabLayout_2->addWidget( Remote_View, 0, 0 ); 182 tabLayout_2->addWidget( Remote_View, 0, 0 );
182 183
183 TabWidget->addWidget( tab_2, "advancedfm/smFileBrowser.png",tr( "2")); 184 TabWidget->addWidget( tab_2, "advancedfm/smFileBrowser.png",tr( "2"));
184 TabWidget->setSizeChange( 370 ); 185 TabWidget->setSizeChange( 370 );
185// TabWidget->insertTab( tab_2, tr( "2")); 186// TabWidget->insertTab( tab_2, tr( "2"));
186 187
187 /* tab_3 = new QWidget( TabWidget, "tab_3" ); 188 /* tab_3 = new QWidget( TabWidget, "tab_3" );
188 tabLayout_3 = new QGridLayout( tab_3 ); 189 tabLayout_3 = new QGridLayout( tab_3 );
189 tabLayout_3->setSpacing( 2); 190 tabLayout_3->setSpacing( 2);
190 tabLayout_3->setMargin( 2); 191 tabLayout_3->setMargin( 2);
191 192
192 193
193 // OFileDialog fileDialog; 194 // OFileDialog fileDialog;
194 // fileDialog; 195 // fileDialog;
195 // fileSelector = new FileSelector( "*",tab_3, "fileselector" , FALSE, FALSE); //buggy 196 // fileSelector = new FileSelector( "*",tab_3, "fileselector" , FALSE, FALSE); //buggy
196 // fileDialog = new OFileDialog("bangalow", tab_3, 4, 2, "Bungalow"); 197 // fileDialog = new OFileDialog("bangalow", tab_3, 4, 2, "Bungalow");
197 // OFileSelector fileDialog = new OFileSelector( tab_3, 4, 2,"/"); 198 // OFileSelector fileDialog = new OFileSelector( tab_3, 4, 2,"/");
198 199
199 QListView *fileTree; 200 QListView *fileTree;
200 fileTree = new QListView( tab_3, "tree" ); 201 fileTree = new QListView( tab_3, "tree" );
201 202
202 203
203 tabLayout_3->addMultiCellWidget( fileTree, 0, 0, 0, 3 ); 204 tabLayout_3->addMultiCellWidget( fileTree, 0, 0, 0, 3 );
204 205
205 TabWidget->insertTab( tab_3, tr( "Remote" ) ); 206 TabWidget->insertTab( tab_3, tr( "Remote" ) );
206 */ 207 */
207 208
208 /////////////// 209 ///////////////
209 210
210 if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" )) 211 if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" ))
211 zaurusDevice=TRUE; 212 zaurusDevice=TRUE;
212 else 213 else
213 zaurusDevice=FALSE; 214 zaurusDevice=FALSE;
214 215
215 216
216 if( !StorageInfo::hasSd() || !StorageInfo::hasMmc()) { 217 if( !StorageInfo::hasSd() || !StorageInfo::hasMmc()) {
217 qDebug("not have sd"); 218 qDebug("not have sd");
218 sdButton->hide(); 219 sdButton->hide();
219 } 220 }
220 if( !StorageInfo::hasCf() ) { 221 if( !StorageInfo::hasCf() ) {
221 qDebug("not have cf"); 222 qDebug("not have cf");
diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp
index 9e740d0..a694b70 100644
--- a/noncore/apps/advancedfm/advancedfmMenu.cpp
+++ b/noncore/apps/advancedfm/advancedfmMenu.cpp
@@ -1,226 +1,228 @@
1/*************************************************************************** 1/***************************************************************************
2 AdvancedFm.cpp 2 AdvancedFm.cpp
3 ------------------- 3 -------------------
4 ** Created: Sat Mar 9 23:33:09 2002 4 ** Created: Sat Mar 9 23:33:09 2002
5 copyright : (C) 2002 by ljp 5 copyright : (C) 2002 by ljp
6 email : ljp@llornkcor.com 6 email : ljp@llornkcor.com
7 * This program is free software; you can redistribute it and/or modify * 7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by * 8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or * 9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. * 10 * (at your option) any later version. *
11 ***************************************************************************/ 11 ***************************************************************************/
12#include "advancedfm.h" 12#include "advancedfm.h"
13#include "output.h" 13#include "output.h"
14#include "filePermissions.h" 14#include "filePermissions.h"
15 15
16#include <qpe/lnkproperties.h> 16#include <qpe/lnkproperties.h>
17#include <qpe/qpeapplication.h> 17#include <qpe/qpeapplication.h>
18#include <qpe/applnk.h> 18#include <qpe/applnk.h>
19 19
20#include <qmessagebox.h> 20#include <qmessagebox.h>
21 21
22 22
23#include <qpopupmenu.h> 23#include <qpopupmenu.h>
24#include <qlistview.h> 24#include <qlistview.h>
25 25
26#include <errno.h> 26#include <errno.h>
27#include <stdlib.h> 27#include <stdlib.h>
28#include <unistd.h> 28#include <unistd.h>
29#include <sys/stat.h> 29#include <sys/stat.h>
30#include <dirent.h> 30#include <dirent.h>
31#include <sys/sendfile.h> 31#include <sys/sendfile.h>
32#include <fcntl.h> 32#include <fcntl.h>
33 33
34 34
35using namespace Opie::Core;
36using namespace Opie::Core;
35void AdvancedFm::doDirChange() { 37void AdvancedFm::doDirChange() {
36 QString pathItem = CurrentView()->currentItem()->text(0); 38 QString pathItem = CurrentView()->currentItem()->text(0);
37 if( pathItem == "../") { 39 if( pathItem == "../") {
38 ListClicked( CurrentView()->currentItem()); 40 ListClicked( CurrentView()->currentItem());
39 } else { 41 } else {
40 if( pathItem.find(" -> ",0,TRUE) != -1) 42 if( pathItem.find(" -> ",0,TRUE) != -1)
41 pathItem = dealWithSymName((const QString&)pathItem)+"/"; 43 pathItem = dealWithSymName((const QString&)pathItem)+"/";
42// qWarning(pathItem); 44// qWarning(pathItem);
43 gotoDirectory( CurrentDir()->path()+"/"+pathItem.left( pathItem.length() - 1) ); 45 gotoDirectory( CurrentDir()->path()+"/"+pathItem.left( pathItem.length() - 1) );
44 } 46 }
45} 47}
46 48
47void AdvancedFm::showMenuHidden() { 49void AdvancedFm::showMenuHidden() {
48 if (b) { 50 if (b) {
49 CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 51 CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
50 OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 52 OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
51 fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); 53 fileMenu->setItemChecked( fileMenu->idAt(0),TRUE);
52 } else { 54 } else {
53 CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 55 CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
54 OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 56 OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
55 fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); 57 fileMenu->setItemChecked( fileMenu->idAt(0),FALSE);
56 } 58 }
57 b = !b; 59 b = !b;
58 populateView(); 60 populateView();
59} 61}
60 62
61void AdvancedFm::showHidden() { 63void AdvancedFm::showHidden() {
62 if (b) { 64 if (b) {
63 CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 65 CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
64 OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 66 OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
65 } else { 67 } else {
66 CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 68 CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
67 OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 69 OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
68 } 70 }
69 populateView(); 71 populateView();
70} 72}
71 73
72QString AdvancedFm::dealWithSymName(const QString &fileName) { 74QString AdvancedFm::dealWithSymName(const QString &fileName) {
73 QString strItem = fileName; 75 QString strItem = fileName;
74 return strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); 76 return strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4);
75} 77}
76 78
77void AdvancedFm::runThis() { 79void AdvancedFm::runThis() {
78 if( !CurrentView()->currentItem()) return; 80 if( !CurrentView()->currentItem()) return;
79 QString fs; 81 QString fs;
80 QDir *thisDir = CurrentDir(); 82 QDir *thisDir = CurrentDir();
81 83
82 QString curFile = CurrentView()->currentItem()->text(0); 84 QString curFile = CurrentView()->currentItem()->text(0);
83 QString path = thisDir->canonicalPath(); 85 QString path = thisDir->canonicalPath();
84 86
85 if( curFile.find("@",0,TRUE) !=-1 || curFile.find("->",0,TRUE) !=-1 ) //if symlink 87 if( curFile.find("@",0,TRUE) !=-1 || curFile.find("->",0,TRUE) !=-1 ) //if symlink
86 88
87 curFile = dealWithSymName((const QString&)curFile); 89 curFile = dealWithSymName((const QString&)curFile);
88 90
89 if(curFile != "../") { 91 if(curFile != "../") {
90 92
91 fs = getFileSystemType((const QString &) path); 93 fs = getFileSystemType((const QString &) path);
92 QFileInfo fileInfo( path + "/" + curFile); 94 QFileInfo fileInfo( path + "/" + curFile);
93// qDebug( fileInfo.owner()); 95// qDebug( fileInfo.owner());
94 96
95 if( (fileInfo.permission( QFileInfo::ExeUser) 97 if( (fileInfo.permission( QFileInfo::ExeUser)
96 | fileInfo.permission( QFileInfo::ExeGroup) 98 | fileInfo.permission( QFileInfo::ExeGroup)
97 | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { 99 | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) {
98 | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { 100 | fs == "vfat" && fileInfo.filePath().contains("/bin") ) {
99 QCopEnvelope e("QPE/System", "execute(QString)" ); 101 QCopEnvelope e("QPE/System", "execute(QString)" );
100 e << curFile; 102 e << curFile;
101 } else { 103 } else {
102 curFile = path + "/" + curFile; 104 curFile = path + "/" + curFile;
103 DocLnk nf(curFile); 105 DocLnk nf(curFile);
104 QString execStr = nf.exec(); 106 QString execStr = nf.exec();
105// qDebug( execStr); 107// qDebug( execStr);
106 if( execStr.isEmpty() ) { 108 if( execStr.isEmpty() ) {
107 } else { 109 } else {
108 nf.execute(); 110 nf.execute();
109 } 111 }
110 } 112 }
111 } 113 }
112} 114}
113 115
114void AdvancedFm::runText() { 116void AdvancedFm::runText() {
115 if( !CurrentView()->currentItem()) return; 117 if( !CurrentView()->currentItem()) return;
116 QString curFile = CurrentView()->currentItem()->text(0); 118 QString curFile = CurrentView()->currentItem()->text(0);
117 if(curFile != "../") { 119 if(curFile != "../") {
118 if( curFile.find("@",0,TRUE) !=-1 || curFile.find("->",0,TRUE) !=-1 ) //if symlink 120 if( curFile.find("@",0,TRUE) !=-1 || curFile.find("->",0,TRUE) !=-1 ) //if symlink
119 curFile = dealWithSymName((const QString&)curFile); 121 curFile = dealWithSymName((const QString&)curFile);
120 curFile = CurrentDir()->canonicalPath()+"/"+curFile; 122 curFile = CurrentDir()->canonicalPath()+"/"+curFile;
121 QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); 123 QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" );
122 e << curFile; 124 e << curFile;
123 } 125 }
124} 126}
125 127
126void AdvancedFm::makeDir() { 128void AdvancedFm::makeDir() {
127 InputDialog *fileDlg; 129 InputDialog *fileDlg;
128 fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); 130 fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0);
129 fileDlg->exec(); 131 fileDlg->exec();
130 if( fileDlg->result() == 1 ) { 132 if( fileDlg->result() == 1 ) {
131 QDir *thisDir = CurrentDir(); 133 QDir *thisDir = CurrentDir();
132 QString filename = fileDlg->LineEdit1->text(); 134 QString filename = fileDlg->LineEdit1->text();
133 thisDir->mkdir( thisDir->canonicalPath()+"/"+filename); 135 thisDir->mkdir( thisDir->canonicalPath()+"/"+filename);
134 } 136 }
135 populateView(); 137 populateView();
136} 138}
137 139
138void AdvancedFm::doDelete() { 140void AdvancedFm::doDelete() {
139 QStringList curFileList = getPath(); 141 QStringList curFileList = getPath();
140 bool doMsg=true; 142 bool doMsg=true;
141 int count = curFileList.count(); 143 int count = curFileList.count();
142 if( count > 0) { 144 if( count > 0) {
143 if(count > 1 ) { 145 if(count > 1 ) {
144 QString msg; 146 QString msg;
145 msg=tr("Really delete\n%1 files?").arg(count); 147 msg=tr("Really delete\n%1 files?").arg(count);
146 switch ( QMessageBox::warning(this,tr("Delete"),msg 148 switch ( QMessageBox::warning(this,tr("Delete"),msg
147 ,tr("Yes"),tr("No"),0,0,1) ) 149 ,tr("Yes"),tr("No"),0,0,1) )
148 { 150 {
149 case 0: 151 case 0:
150 doMsg=false; 152 doMsg=false;
151 break; 153 break;
152 case 1: 154 case 1:
153 return; 155 return;
154 break; 156 break;
155 }; 157 };
156 } 158 }
157 159
158 QString myFile; 160 QString myFile;
159 161
160 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 162 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
161 myFile = (*it); 163 myFile = (*it);
162 if( myFile.find(" -> ",0,TRUE) != -1) 164 if( myFile.find(" -> ",0,TRUE) != -1)
163 myFile = myFile.left( myFile.find(" -> ",0,TRUE)); 165 myFile = myFile.left( myFile.find(" -> ",0,TRUE));
164 166
165 QString f = CurrentDir()->canonicalPath(); 167 QString f = CurrentDir()->canonicalPath();
166 if(f.right(1).find("/",0,TRUE) == -1) 168 if(f.right(1).find("/",0,TRUE) == -1)
167 f += "/"; 169 f += "/";
168 f += myFile; 170 f += myFile;
169 if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { 171 if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) {
170 //if file is a directory 172 //if file is a directory
171 173
172 switch ( QMessageBox::warning( this, tr("Delete Directory?"), 174 switch ( QMessageBox::warning( this, tr("Delete Directory?"),
173 tr("Really delete %1\nand all it's contents ?" ).arg( f ) , 175 tr("Really delete %1\nand all it's contents ?" ).arg( f ) ,
174 tr("Yes"), tr("No"), 0, 0, 1) ) { 176 tr("Yes"), tr("No"), 0, 0, 1) ) {
175 case 0: 177 case 0:
176 { 178 {
177 f=f.left(f.length()-1); 179 f=f.left(f.length()-1);
178 QString cmd="rm -rf "+f; 180 QString cmd="rm -rf "+f;
179 startProcess( (const QString)cmd.latin1() ); 181 startProcess( (const QString)cmd.latin1() );
180 populateView(); 182 populateView();
181 } 183 }
182 break; 184 break;
183 case 1: 185 case 1:
184 // exit 186 // exit
185 break; 187 break;
186 }; 188 };
187 189
188 } else { 190 } else {
189 if(doMsg) { 191 if(doMsg) {
190 switch ( QMessageBox::warning(this,tr("Delete"), 192 switch ( QMessageBox::warning(this,tr("Delete"),
191 tr("Really delete\n%1?").arg( myFile ), 193 tr("Really delete\n%1?").arg( myFile ),
192 tr("Yes"), tr("No"), 0, 0, 1) ) { 194 tr("Yes"), tr("No"), 0, 0, 1) ) {
193 case 1: 195 case 1:
194 return; 196 return;
195 break; 197 break;
196 }; 198 };
197 } 199 }
198 200
199 QString cmd="rm "+f; 201 QString cmd="rm "+f;
200 QFile file(f); 202 QFile file(f);
201 QFileInfo fi(myFile); 203 QFileInfo fi(myFile);
202 if( fi.fileName().find("../",0,TRUE)==-1) { 204 if( fi.fileName().find("../",0,TRUE)==-1) {
203// qDebug("remove link files "+myFile); 205// qDebug("remove link files "+myFile);
204 206
205// DocLnk lnk(f); 207// DocLnk lnk(f);
206 DocLnk *lnk; 208 DocLnk *lnk;
207 lnk = new DocLnk(f); 209 lnk = new DocLnk(f);
208// qDebug("Deleting doclnk " + lnk->linkFile()); 210// qDebug("Deleting doclnk " + lnk->linkFile());
209 if(lnk->isValid()) 211 if(lnk->isValid())
210 lnk->removeLinkFile(); 212 lnk->removeLinkFile();
211 // delete lnk; 213 // delete lnk;
212 file.remove(); 214 file.remove();
213 } 215 }
214 } 216 }
215 } 217 }
216 } 218 }
217 populateView(); 219 populateView();
218} 220}
219 221
220void AdvancedFm::filePerms() { 222void AdvancedFm::filePerms() {
221 QStringList curFileList = getPath(); 223 QStringList curFileList = getPath();
222 QString filePath; 224 QString filePath;
223 225
224 filePath = CurrentDir()->canonicalPath()+"/"; 226 filePath = CurrentDir()->canonicalPath()+"/";
225 227
226 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 228 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
@@ -513,324 +515,324 @@ bool AdvancedFm::copyFile( const QString & src, const QString & dest ) {
513 } 515 }
514 516
515 517
516 bool success = true; 518 bool success = true;
517 struct stat status; 519 struct stat status;
518 QFile srcFile(src); 520 QFile srcFile(src);
519 QFile destFile(dest); 521 QFile destFile(dest);
520 int err=0; 522 int err=0;
521 int read_fd=0; 523 int read_fd=0;
522 int write_fd=0; 524 int write_fd=0;
523 struct stat stat_buf; 525 struct stat stat_buf;
524 off_t offset = 0; 526 off_t offset = 0;
525 if(!srcFile.open( IO_ReadOnly|IO_Raw)) { 527 if(!srcFile.open( IO_ReadOnly|IO_Raw)) {
526// qWarning("open failed"); 528// qWarning("open failed");
527 return success = false; 529 return success = false;
528 } 530 }
529 read_fd = srcFile.handle(); 531 read_fd = srcFile.handle();
530 if(read_fd != -1) { 532 if(read_fd != -1) {
531 fstat (read_fd, &stat_buf); 533 fstat (read_fd, &stat_buf);
532 if( !destFile.open( IO_WriteOnly|IO_Raw ) ) { 534 if( !destFile.open( IO_WriteOnly|IO_Raw ) ) {
533// qWarning("destfile open failed"); 535// qWarning("destfile open failed");
534 return success = false; 536 return success = false;
535 } 537 }
536 write_fd = destFile.handle(); 538 write_fd = destFile.handle();
537 if(write_fd != -1) { 539 if(write_fd != -1) {
538 err = sendfile(write_fd, read_fd, &offset, stat_buf.st_size); 540 err = sendfile(write_fd, read_fd, &offset, stat_buf.st_size);
539 if( err == -1) { 541 if( err == -1) {
540 QString msg; 542 QString msg;
541 switch(err) { 543 switch(err) {
542 case EBADF : msg = "The input file was not opened for reading or the output file was not opened for writing. "; 544 case EBADF : msg = "The input file was not opened for reading or the output file was not opened for writing. ";
543 case EINVAL: msg = "Descriptor is not valid or locked. "; 545 case EINVAL: msg = "Descriptor is not valid or locked. ";
544 case ENOMEM: msg = "Insufficient memory to read from in_fd."; 546 case ENOMEM: msg = "Insufficient memory to read from in_fd.";
545 case EIO: msg = "Unspecified error while reading from in_fd."; 547 case EIO: msg = "Unspecified error while reading from in_fd.";
546 }; 548 };
547 success = false; 549 success = false;
548// qWarning(msg); 550// qWarning(msg);
549 } 551 }
550 } else { 552 } else {
551 success = false; 553 success = false;
552 } 554 }
553 } else { 555 } else {
554 success = false; 556 success = false;
555 } 557 }
556 srcFile.close(); 558 srcFile.close();
557 destFile.close(); 559 destFile.close();
558 // Set file permissions 560 // Set file permissions
559 if( stat( (const char *) src, &status ) == 0 ) { 561 if( stat( (const char *) src, &status ) == 0 ) {
560 chmod( (const char *) dest, status.st_mode ); 562 chmod( (const char *) dest, status.st_mode );
561 } 563 }
562 564
563 return success; 565 return success;
564} 566}
565 567
566void AdvancedFm::runCommand() { 568void AdvancedFm::runCommand() {
567 if( !CurrentView()->currentItem()) return; 569 if( !CurrentView()->currentItem()) return;
568 QDir *thisDir = CurrentDir(); 570 QDir *thisDir = CurrentDir();
569 571
570 QString curFile; 572 QString curFile;
571 curFile = thisDir->canonicalPath() +"/"+ CurrentView()->currentItem()->text(0); 573 curFile = thisDir->canonicalPath() +"/"+ CurrentView()->currentItem()->text(0);
572 574
573 InputDialog *fileDlg; 575 InputDialog *fileDlg;
574 fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); 576 fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0);
575 fileDlg->setInputText(curFile); 577 fileDlg->setInputText(curFile);
576 fileDlg->exec(); 578 fileDlg->exec();
577 //QString command; 579 //QString command;
578 580
579 if( fileDlg->result() == 1 ) { 581 if( fileDlg->result() == 1 ) {
580// qDebug(fileDlg->LineEdit1->text()); 582// qDebug(fileDlg->LineEdit1->text());
581 QStringList command; 583 QStringList command;
582 584
583 command << "/bin/sh"; 585 command << "/bin/sh";
584 command << "-c"; 586 command << "-c";
585 command << fileDlg->LineEdit1->text(); 587 command << fileDlg->LineEdit1->text();
586 Output *outDlg; 588 Output *outDlg;
587 outDlg = new Output( command, this, tr("AdvancedFm Output"), true); 589 outDlg = new Output( command, this, tr("AdvancedFm Output"), true);
588 QPEApplication::execDialog( outDlg ); 590 QPEApplication::execDialog( outDlg );
589 qApp->processEvents(); 591 qApp->processEvents();
590 592
591 } 593 }
592} 594}
593 595
594void AdvancedFm::runCommandStd() { 596void AdvancedFm::runCommandStd() {
595 if( !CurrentView()->currentItem()) return; 597 if( !CurrentView()->currentItem()) return;
596 QString curFile; 598 QString curFile;
597 QDir *thisDir = CurrentDir(); 599 QDir *thisDir = CurrentDir();
598 QListView *thisView = CurrentView(); 600 QListView *thisView = CurrentView();
599 if( thisView->currentItem()) 601 if( thisView->currentItem())
600 curFile = thisDir->canonicalPath() +"/"+ thisView->currentItem()->text(0); 602 curFile = thisDir->canonicalPath() +"/"+ thisView->currentItem()->text(0);
601 603
602 InputDialog *fileDlg; 604 InputDialog *fileDlg;
603 fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); 605 fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0);
604 fileDlg->setInputText(curFile); 606 fileDlg->setInputText(curFile);
605 fileDlg->exec(); 607 fileDlg->exec();
606 608
607 if( fileDlg->result() == 1 ) { 609 if( fileDlg->result() == 1 ) {
608 qApp->processEvents(); 610 qApp->processEvents();
609 startProcess( (const QString)fileDlg->LineEdit1->text().latin1()); 611 startProcess( (const QString)fileDlg->LineEdit1->text().latin1());
610 } 612 }
611} 613}
612 614
613void AdvancedFm::fileStatus() { 615void AdvancedFm::fileStatus() {
614 if( !CurrentView()->currentItem()) return; 616 if( !CurrentView()->currentItem()) return;
615 QString curFile; 617 QString curFile;
616 curFile = CurrentView()->currentItem()->text(0); 618 curFile = CurrentView()->currentItem()->text(0);
617 619
618 QStringList command; 620 QStringList command;
619 command << "/bin/sh"; 621 command << "/bin/sh";
620 command << "-c"; 622 command << "-c";
621 command << "stat -l "+ curFile; 623 command << "stat -l "+ curFile;
622 624
623 Output *outDlg; 625 Output *outDlg;
624 outDlg = new Output( command, this, tr("AdvancedFm Output"), true); 626 outDlg = new Output( command, this, tr("AdvancedFm Output"), true);
625 QPEApplication::execDialog( outDlg ); 627 QPEApplication::execDialog( outDlg );
626 qApp->processEvents(); 628 qApp->processEvents();
627} 629}
628 630
629 631
630void AdvancedFm::mkDir() { 632void AdvancedFm::mkDir() {
631 makeDir(); 633 makeDir();
632} 634}
633 635
634void AdvancedFm::rn() { 636void AdvancedFm::rn() {
635 renameIt(); 637 renameIt();
636} 638}
637 639
638void AdvancedFm::del() { 640void AdvancedFm::del() {
639 doDelete(); 641 doDelete();
640} 642}
641 643
642void AdvancedFm::mkSym() { 644void AdvancedFm::mkSym() {
643 QString cmd; 645 QString cmd;
644 QStringList curFileList = getPath(); 646 QStringList curFileList = getPath();
645 if( curFileList.count() > 0) { 647 if( curFileList.count() > 0) {
646 QDir *thisDir = CurrentDir(); 648 QDir *thisDir = CurrentDir();
647 QDir * thatDir = OtherDir(); 649 QDir * thatDir = OtherDir();
648 650
649 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 651 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
650 652
651 QString destName = thatDir->canonicalPath()+"/"+(*it); 653 QString destName = thatDir->canonicalPath()+"/"+(*it);
652 if(destName.right(1) == "/") { 654 if(destName.right(1) == "/") {
653 destName = destName.left( destName.length() -1); 655 destName = destName.left( destName.length() -1);
654 } 656 }
655 657
656 QString curFile = thisDir->canonicalPath()+"/"+(*it); 658 QString curFile = thisDir->canonicalPath()+"/"+(*it);
657 659
658 if( curFile.right(1) == "/") { 660 if( curFile.right(1) == "/") {
659 curFile = curFile.left( curFile.length() -1); 661 curFile = curFile.left( curFile.length() -1);
660 } 662 }
661 663
662 cmd = "ln -s "+curFile+" "+destName; 664 cmd = "ln -s "+curFile+" "+destName;
663// qDebug(cmd); 665// qDebug(cmd);
664 startProcess( (const QString)cmd ); 666 startProcess( (const QString)cmd );
665 } 667 }
666 rePopulate(); 668 rePopulate();
667 setOtherTabCurrent(); 669 setOtherTabCurrent();
668 } 670 }
669} 671}
670 672
671void AdvancedFm::doBeam() { 673void AdvancedFm::doBeam() {
672 Ir ir; 674 Ir ir;
673 if(!ir.supported()) { 675 if(!ir.supported()) {
674 } else { 676 } else {
675 QStringList curFileList = getPath(); 677 QStringList curFileList = getPath();
676 if( curFileList.count() > 0) { 678 if( curFileList.count() > 0) {
677 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 679 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
678 QString curFile = (*it); 680 QString curFile = (*it);
679 QString curFilePath = CurrentDir()->canonicalPath()+"/"+curFile; 681 QString curFilePath = CurrentDir()->canonicalPath()+"/"+curFile;
680 if( curFilePath.right(1) == "/") { 682 if( curFilePath.right(1) == "/") {
681 curFilePath = curFilePath.left( curFilePath.length() -1); 683 curFilePath = curFilePath.left( curFilePath.length() -1);
682 } 684 }
683 Ir *file = new Ir(this, "IR"); 685 Ir *file = new Ir(this, "IR");
684 connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished(Ir*))); 686 connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished(Ir*)));
685 file->send( curFilePath, curFile ); 687 file->send( curFilePath, curFile );
686 } 688 }
687 } 689 }
688 } 690 }
689} 691}
690 692
691void AdvancedFm::fileBeamFinished( Ir *) { 693void AdvancedFm::fileBeamFinished( Ir *) {
692 QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") ); 694 QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") );
693} 695}
694 696
695void AdvancedFm::selectAll() { 697void AdvancedFm::selectAll() {
696 QListView *thisView = CurrentView(); 698 QListView *thisView = CurrentView();
697 thisView->selectAll(true); 699 thisView->selectAll(true);
698 thisView->setSelected( thisView->firstChild(),false); 700 thisView->setSelected( thisView->firstChild(),false);
699} 701}
700 702
701void AdvancedFm::startProcess(const QString & cmd) { 703void AdvancedFm::startProcess(const QString & cmd) {
702 QStringList command; 704 QStringList command;
703 OProcess *process; 705 OProcess *process;
704 process = new OProcess(); 706 process = new OProcess();
705 connect(process, SIGNAL(processExited(OProcess*)), 707 connect(process, SIGNAL(processExited(Opie::Core::OProcess*)),
706 this, SLOT( processEnded(OProcess*))); 708 this, SLOT( processEnded(OProcess*)));
707 709
708 connect(process, SIGNAL( receivedStderr(OProcess*,char*,int)), 710 connect(process, SIGNAL( receivedStderr(Opie::Core::OProcess*,char*,int)),
709 this, SLOT( oprocessStderr(OProcess*,char*,int))); 711 this, SLOT( oprocessStderr(OProcess*,char*,int)));
710 712
711 command << "/bin/sh"; 713 command << "/bin/sh";
712 command << "-c"; 714 command << "-c";
713 command << cmd.latin1(); 715 command << cmd.latin1();
714 *process << command; 716 *process << command;
715 if(!process->start(OProcess::NotifyOnExit, OProcess::All) ) 717 if(!process->start(OProcess::NotifyOnExit, OProcess::All) )
716 qDebug("could not start process"); 718 qDebug("could not start process");
717} 719}
718 720
719void AdvancedFm::processEnded(OProcess *) { 721void AdvancedFm::processEnded(OProcess *) {
720 rePopulate(); 722 rePopulate();
721} 723}
722 724
723void AdvancedFm::oprocessStderr(OProcess*, char *buffer, int ) { 725void AdvancedFm::oprocessStderr(OProcess*, char *buffer, int ) {
724// qWarning("received stderrt %d bytes", buflen); 726// qWarning("received stderrt %d bytes", buflen);
725 727
726 QString lineStr = buffer; 728 QString lineStr = buffer;
727 QMessageBox::warning( this, tr("Error"), lineStr ,tr("Ok") ); 729 QMessageBox::warning( this, tr("Error"), lineStr ,tr("Ok") );
728} 730}
729 731
730bool AdvancedFm::eventFilter( QObject * o, QEvent * e ) { 732bool AdvancedFm::eventFilter( QObject * o, QEvent * e ) {
731 if ( o->inherits( "QLineEdit" ) ) { 733 if ( o->inherits( "QLineEdit" ) ) {
732 if ( e->type() == QEvent::KeyPress ) { 734 if ( e->type() == QEvent::KeyPress ) {
733 QKeyEvent *ke = (QKeyEvent*)e; 735 QKeyEvent *ke = (QKeyEvent*)e;
734 if ( ke->key() == Key_Return || 736 if ( ke->key() == Key_Return ||
735 ke->key() == Key_Enter ) { 737 ke->key() == Key_Enter ) {
736 okRename(); 738 okRename();
737 return true; 739 return true;
738 } 740 }
739 else if ( ke->key() == Key_Escape ) { 741 else if ( ke->key() == Key_Escape ) {
740 cancelRename(); 742 cancelRename();
741 return true; 743 return true;
742 } 744 }
743 } 745 }
744 else if ( e->type() == QEvent::FocusOut ) { 746 else if ( e->type() == QEvent::FocusOut ) {
745 cancelRename(); 747 cancelRename();
746 return true; 748 return true;
747 } 749 }
748 } 750 }
749 if ( o->inherits( "QListView" ) ) { 751 if ( o->inherits( "QListView" ) ) {
750 if ( e->type() == QEvent::FocusIn ) { 752 if ( e->type() == QEvent::FocusIn ) {
751 if( o == Local_View) { //keep track of which view 753 if( o == Local_View) { //keep track of which view
752 whichTab=1; 754 whichTab=1;
753 } 755 }
754 else { 756 else {
755 whichTab=2; 757 whichTab=2;
756 } 758 }
757 } 759 }
758 OtherView()->setSelected( OtherView()->currentItem(), FALSE );//make sure there's correct selection 760 OtherView()->setSelected( OtherView()->currentItem(), FALSE );//make sure there's correct selection
759 } 761 }
760 762
761 return QWidget::eventFilter( o, e ); 763 return QWidget::eventFilter( o, e );
762} 764}
763 765
764 766
765void AdvancedFm::cancelRename() { 767void AdvancedFm::cancelRename() {
766// qDebug("cancel rename"); 768// qDebug("cancel rename");
767 QListView * view; 769 QListView * view;
768 view = CurrentView(); 770 view = CurrentView();
769 771
770 bool resetFocus = view->viewport()->focusProxy() == renameBox; 772 bool resetFocus = view->viewport()->focusProxy() == renameBox;
771 delete renameBox; 773 delete renameBox;
772 renameBox = 0; 774 renameBox = 0;
773 if ( resetFocus ) { 775 if ( resetFocus ) {
774 view->viewport()->setFocusProxy( view); 776 view->viewport()->setFocusProxy( view);
775 view->setFocus(); 777 view->setFocus();
776 } 778 }
777} 779}
778 780
779void AdvancedFm::doRename(QListView * view) { 781void AdvancedFm::doRename(QListView * view) {
780 if( !CurrentView()->currentItem()) return; 782 if( !CurrentView()->currentItem()) return;
781 783
782 QRect r = view->itemRect( view->currentItem( )); 784 QRect r = view->itemRect( view->currentItem( ));
783 r = QRect( view->viewportToContents( r.topLeft() ), r.size() ); 785 r = QRect( view->viewportToContents( r.topLeft() ), r.size() );
784 r.setX( view->contentsX() ); 786 r.setX( view->contentsX() );
785 787
786 if ( r.width() > view->visibleWidth() ) 788 if ( r.width() > view->visibleWidth() )
787 r.setWidth( view->visibleWidth() ); 789 r.setWidth( view->visibleWidth() );
788 790
789 renameBox = new QLineEdit( view->viewport(), "qt_renamebox" ); 791 renameBox = new QLineEdit( view->viewport(), "qt_renamebox" );
790 renameBox->setFrame(true); 792 renameBox->setFrame(true);
791 793
792 renameBox->setText( view->currentItem()->text(0) ); 794 renameBox->setText( view->currentItem()->text(0) );
793 795
794 renameBox->selectAll(); 796 renameBox->selectAll();
795 renameBox->installEventFilter( this ); 797 renameBox->installEventFilter( this );
796 798
797 view->addChild( renameBox, r.x(), r.y() ); 799 view->addChild( renameBox, r.x(), r.y() );
798 800
799 renameBox->resize( r.size() ); 801 renameBox->resize( r.size() );
800 802
801 view->viewport()->setFocusProxy( renameBox ); 803 view->viewport()->setFocusProxy( renameBox );
802 804
803 renameBox->setFocus(); 805 renameBox->setFocus();
804 renameBox->show(); 806 renameBox->show();
805} 807}
806 808
807 809
808void AdvancedFm::renameIt() { 810void AdvancedFm::renameIt() {
809 if( !CurrentView()->currentItem()) return; 811 if( !CurrentView()->currentItem()) return;
810 812
811 QListView *thisView = CurrentView(); 813 QListView *thisView = CurrentView();
812 oldName = thisView->currentItem()->text(0); 814 oldName = thisView->currentItem()->text(0);
813 doRename( thisView ); 815 doRename( thisView );
814} 816}
815 817
816void AdvancedFm::okRename() { 818void AdvancedFm::okRename() {
817 if( !CurrentView()->currentItem()) return; 819 if( !CurrentView()->currentItem()) return;
818 820
819 QString newName = renameBox->text(); 821 QString newName = renameBox->text();
820 cancelRename(); 822 cancelRename();
821 QListView * view = CurrentView(); 823 QListView * view = CurrentView();
822 QString path = CurrentDir()->canonicalPath() + "/"; 824 QString path = CurrentDir()->canonicalPath() + "/";
823 oldName = path + oldName; 825 oldName = path + oldName;
824 newName = path + newName; 826 newName = path + newName;
825 if( rename( oldName.latin1(), newName.latin1())== -1) 827 if( rename( oldName.latin1(), newName.latin1())== -1)
826 QMessageBox::message(tr("Note"),tr("Could not rename")); 828 QMessageBox::message(tr("Note"),tr("Could not rename"));
827 else 829 else
828 oldName = ""; 830 oldName = "";
829 view->takeItem( view->currentItem() ); 831 view->takeItem( view->currentItem() );
830 delete view->currentItem(); 832 delete view->currentItem();
831 rePopulate(); 833 rePopulate();
832} 834}
833 835
834void AdvancedFm::openSearch() { 836void AdvancedFm::openSearch() {
835 QMessageBox::message(tr("Note"),tr("Not Yet Implemented")); 837 QMessageBox::message(tr("Note"),tr("Not Yet Implemented"));
836} 838}
diff --git a/noncore/apps/advancedfm/main.cpp b/noncore/apps/advancedfm/main.cpp
index 3c1a164..df0d4af 100644
--- a/noncore/apps/advancedfm/main.cpp
+++ b/noncore/apps/advancedfm/main.cpp
@@ -1,33 +1,22 @@
1 1
2/*************************************************************************** 2/***************************************************************************
3using namespace Opie::Core;
4using namespace Opie::Core;
3 main.cpp - description 5 main.cpp - description
4 ------------------- 6 -------------------
5 begin : March 10, 2002 7 begin : March 10, 2002
6 copyright : (C) 2002 by llornkcor 8 copyright : (C) 2002 by llornkcor
7 email : ljp@llornkcor.com 9 email : ljp@llornkcor.com
8 * This program is free software; you can redistribute it and/or modify * 10 * This program is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU General Public License as published by * 11 * it under the terms of the GNU General Public License as published by *
10 * the Free Software Foundation; either version 2 of the License, or * 12 * the Free Software Foundation; either version 2 of the License, or *
11 * (at your option) any later version. * 13 * (at your option) any later version. *
12 ***************************************************************************/ 14 ***************************************************************************/
13 15
14#include "advancedfm.h" 16#include "advancedfm.h"
15
16#ifdef NOQUICKLAUNCH
17
18#include <qpe/qpeapplication.h>
19
20int main(int argc, char *argv[])
21{
22 QPEApplication a(argc, argv);
23
24 AdvancedFm advencedFm;
25 a.showMainWidget( &advencedFm);
26 return a.exec();
27}
28#else
29#include <opie2/oapplicationfactory.h> 17#include <opie2/oapplicationfactory.h>
30 18
19using namespace Opie::Core;
20
31OPIE_EXPORT_APP( OApplicationFactory<AdvancedFm> ) 21OPIE_EXPORT_APP( OApplicationFactory<AdvancedFm> )
32 22
33#endif
diff --git a/noncore/apps/advancedfm/output.cpp b/noncore/apps/advancedfm/output.cpp
index 0bba1d8..16a0992 100644
--- a/noncore/apps/advancedfm/output.cpp
+++ b/noncore/apps/advancedfm/output.cpp
@@ -1,276 +1,278 @@
1/**************************************************************************** 1/****************************************************************************
2** outputEdit.cpp 2** outputEdit.cpp
3** 3**
4** Copyright: Fri Apr 12 15:12:58 2002 L.J. Potter <ljp@llornkcor.com> 4** Copyright: Fri Apr 12 15:12:58 2002 L.J. Potter <ljp@llornkcor.com>
5****************************************************************************/ 5****************************************************************************/
6#include "output.h" 6#include "output.h"
7 7
8#include <qpe/qpeapplication.h> 8#include <qpe/qpeapplication.h>
9#include <qpe/applnk.h> 9#include <qpe/applnk.h>
10 10
11#include <qfile.h> 11#include <qfile.h>
12#include <qmultilineedit.h> 12#include <qmultilineedit.h>
13#include <qpushbutton.h> 13#include <qpushbutton.h>
14#include <qlayout.h> 14#include <qlayout.h>
15 15
16#include <errno.h> 16#include <errno.h>
17 17
18/* XPM */ 18/* XPM */
19using namespace Opie::Core;
20using namespace Opie::Core;
19static char * filesave_xpm[] = { 21static char * filesave_xpm[] = {
20"16 16 78 1", 22"16 16 78 1",
21" c None", 23" c None",
22". c #343434", 24". c #343434",
23"+ c #A0A0A0", 25"+ c #A0A0A0",
24"@ c #565656", 26"@ c #565656",
25"# c #9E9E9E", 27"# c #9E9E9E",
26"$ c #525252", 28"$ c #525252",
27"% c #929292", 29"% c #929292",
28"& c #676767", 30"& c #676767",
29"* c #848484", 31"* c #848484",
30"= c #666666", 32"= c #666666",
31"- c #D8D8D8", 33"- c #D8D8D8",
32"; c #FFFFFF", 34"; c #FFFFFF",
33"> c #DBDBDB", 35"> c #DBDBDB",
34", c #636363", 36", c #636363",
35"' c #989898", 37"' c #989898",
36") c #2D2D2D", 38") c #2D2D2D",
37"! c #909090", 39"! c #909090",
38"~ c #AEAEAE", 40"~ c #AEAEAE",
39"{ c #EAEAEA", 41"{ c #EAEAEA",
40"] c #575757", 42"] c #575757",
41"^ c #585858", 43"^ c #585858",
42"/ c #8A8A8A", 44"/ c #8A8A8A",
43"( c #828282", 45"( c #828282",
44"_ c #6F6F6F", 46"_ c #6F6F6F",
45": c #C9C9C9", 47": c #C9C9C9",
46"< c #050505", 48"< c #050505",
47"[ c #292929", 49"[ c #292929",
48"} c #777777", 50"} c #777777",
49"| c #616161", 51"| c #616161",
50"1 c #3A3A3A", 52"1 c #3A3A3A",
51"2 c #BEBEBE", 53"2 c #BEBEBE",
52"3 c #2C2C2C", 54"3 c #2C2C2C",
53"4 c #7C7C7C", 55"4 c #7C7C7C",
54"5 c #F6F6F6", 56"5 c #F6F6F6",
55"6 c #FCFCFC", 57"6 c #FCFCFC",
56"7 c #6B6B6B", 58"7 c #6B6B6B",
57"8 c #959595", 59"8 c #959595",
58"9 c #4F4F4F", 60"9 c #4F4F4F",
59"0 c #808080", 61"0 c #808080",
60"a c #767676", 62"a c #767676",
61"b c #818181", 63"b c #818181",
62"c c #B8B8B8", 64"c c #B8B8B8",
63"d c #FBFBFB", 65"d c #FBFBFB",
64"e c #F9F9F9", 66"e c #F9F9F9",
65"f c #CCCCCC", 67"f c #CCCCCC",
66"g c #030303", 68"g c #030303",
67"h c #737373", 69"h c #737373",
68"i c #7A7A7A", 70"i c #7A7A7A",
69"j c #7E7E7E", 71"j c #7E7E7E",
70"k c #6A6A6A", 72"k c #6A6A6A",
71"l c #FAFAFA", 73"l c #FAFAFA",
72"m c #505050", 74"m c #505050",
73"n c #9D9D9D", 75"n c #9D9D9D",
74"o c #333333", 76"o c #333333",
75"p c #7B7B7B", 77"p c #7B7B7B",
76"q c #787878", 78"q c #787878",
77"r c #696969", 79"r c #696969",
78"s c #494949", 80"s c #494949",
79"t c #555555", 81"t c #555555",
80"u c #949494", 82"u c #949494",
81"v c #E6E6E6", 83"v c #E6E6E6",
82"w c #424242", 84"w c #424242",
83"x c #515151", 85"x c #515151",
84"y c #535353", 86"y c #535353",
85"z c #3E3E3E", 87"z c #3E3E3E",
86"A c #D4D4D4", 88"A c #D4D4D4",
87"B c #0C0C0C", 89"B c #0C0C0C",
88"C c #353535", 90"C c #353535",
89"D c #474747", 91"D c #474747",
90"E c #ECECEC", 92"E c #ECECEC",
91"F c #919191", 93"F c #919191",
92"G c #7D7D7D", 94"G c #7D7D7D",
93"H c #000000", 95"H c #000000",
94"I c #404040", 96"I c #404040",
95"J c #858585", 97"J c #858585",
96"K c #323232", 98"K c #323232",
97"L c #D0D0D0", 99"L c #D0D0D0",
98"M c #1C1C1C", 100"M c #1C1C1C",
99" ...+ ", 101" ...+ ",
100" @#$%&..+ ", 102" @#$%&..+ ",
101" .*=-;;>,..+ ", 103" .*=-;;>,..+ ",
102" ')!~;;;;;;{]..", 104" ')!~;;;;;;{]..",
103" ^/(-;;;;;;;_:<", 105" ^/(-;;;;;;;_:<",
104" [}|;;;;;;;{12$", 106" [}|;;;;;;;{12$",
105" #34-55;;;;678$+", 107" #34-55;;;;678$+",
106" 90ab=c;dd;e1fg ", 108" 90ab=c;dd;e1fg ",
107" [ahij((kbl0mn$ ", 109" [ahij((kbl0mn$ ",
108" op^q^^7r&]s/$+ ", 110" op^q^^7r&]s/$+ ",
109"@btu;vbwxy]zAB ", 111"@btu;vbwxy]zAB ",
110"CzDEvEv;;DssF$ ", 112"CzDEvEv;;DssF$ ",
111"G.H{E{E{IxsJ$+ ", 113"G.H{E{E{IxsJ$+ ",
112" +...vEKxzLM ", 114" +...vEKxzLM ",
113" +...z]n$ ", 115" +...z]n$ ",
114" +... "}; 116" +... "};
115 117
116Output::Output( const QStringList commands, QWidget* parent, const char* name, bool modal, WFlags fl) 118Output::Output( const QStringList commands, QWidget* parent, const char* name, bool modal, WFlags fl)
117 : QDialog( parent, name, modal, fl ) 119 : QDialog( parent, name, modal, fl )
118{ 120{
119 QStringList cmmds; 121 QStringList cmmds;
120// cmmds=QStringList::split( " ", commands, false); 122// cmmds=QStringList::split( " ", commands, false);
121 cmmds=commands; 123 cmmds=commands;
122// qDebug("count %d", cmmds.count()); 124// qDebug("count %d", cmmds.count());
123 if ( !name ) 125 if ( !name )
124 setName( tr("Output")); 126 setName( tr("Output"));
125 resize( 196, 269 ); 127 resize( 196, 269 );
126 setCaption( name ); 128 setCaption( name );
127 129
128 OutputLayout = new QGridLayout( this ); 130 OutputLayout = new QGridLayout( this );
129 OutputLayout->setSpacing( 2); 131 OutputLayout->setSpacing( 2);
130 OutputLayout->setMargin( 2); 132 OutputLayout->setMargin( 2);
131 133
132 QPushButton *docButton; 134 QPushButton *docButton;
133 docButton = new QPushButton( QPixmap(( const char** ) filesave_xpm ) ,"",this,"saveButton"); 135 docButton = new QPushButton( QPixmap(( const char** ) filesave_xpm ) ,"",this,"saveButton");
134 docButton->setFixedSize( QSize( 20, 20 ) ); 136 docButton->setFixedSize( QSize( 20, 20 ) );
135 connect( docButton,SIGNAL(released()),this,SLOT( saveOutput() )); 137 connect( docButton,SIGNAL(released()),this,SLOT( saveOutput() ));
136 // docButton->setFlat(TRUE); 138 // docButton->setFlat(TRUE);
137 OutputLayout->addMultiCellWidget( docButton, 0,0,3,3 ); 139 OutputLayout->addMultiCellWidget( docButton, 0,0,3,3 );
138 140
139 OutputEdit = new QMultiLineEdit( this, "OutputEdit" ); 141 OutputEdit = new QMultiLineEdit( this, "OutputEdit" );
140 OutputLayout->addMultiCellWidget( OutputEdit, 1,1,0,3 ); 142 OutputLayout->addMultiCellWidget( OutputEdit, 1,1,0,3 );
141 143
142 proc = new OProcess(); 144 proc = new OProcess();
143 145
144 connect(proc, SIGNAL(processExited(OProcess*)), 146 connect(proc, SIGNAL(processExited(Opie::Core::OProcess*)),
145 this, SLOT( processFinished())); 147 this, SLOT( processFinished()));
146 148
147 connect(proc, SIGNAL(receivedStdout(OProcess*,char*,int)), 149 connect(proc, SIGNAL(receivedStdout(Opie::Core::OProcess*,char*,int)),
148 this, SLOT(commandStdout(OProcess*,char*,int))); 150 this, SLOT(commandStdout(OProcess*,char*,int)));
149 151
150 connect(proc, SIGNAL(receivedStderr(OProcess*,char*,int)), 152 connect(proc, SIGNAL(receivedStderr(Opie::Core::OProcess*,char*,int)),
151 this, SLOT(commandStderr(OProcess*,char*,int))); 153 this, SLOT(commandStderr(OProcess*,char*,int)));
152 154
153// connect( , SIGNAL(received(const QByteArray&)), 155// connect( , SIGNAL(received(const QByteArray&)),
154// this, SLOT(commandStdin(const QByteArray&))); 156// this, SLOT(commandStdin(const QByteArray&)));
155 157
156// * proc << commands.latin1(); 158// * proc << commands.latin1();
157 for ( QStringList::Iterator it = cmmds.begin(); it != cmmds.end(); ++it ) { 159 for ( QStringList::Iterator it = cmmds.begin(); it != cmmds.end(); ++it ) {
158 qDebug( "%s", (*it).latin1() ); 160 qDebug( "%s", (*it).latin1() );
159 * proc << (*it).latin1(); 161 * proc << (*it).latin1();
160 } 162 }
161 163
162 if(!proc->start(OProcess::NotifyOnExit, OProcess::All)) { 164 if(!proc->start(OProcess::NotifyOnExit, OProcess::All)) {
163 165
164 OutputEdit->append(tr("Process could not start") ); 166 OutputEdit->append(tr("Process could not start") );
165 OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE); 167 OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE);
166 perror("Error: "); 168 perror("Error: ");
167 QString errorMsg=tr("Error\n")+(QString)strerror(errno); 169 QString errorMsg=tr("Error\n")+(QString)strerror(errno);
168 OutputEdit->append( errorMsg); 170 OutputEdit->append( errorMsg);
169 OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE); 171 OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE);
170 } 172 }
171} 173}
172 174
173Output::~Output() { 175Output::~Output() {
174} 176}
175 177
176void Output::saveOutput() { 178void Output::saveOutput() {
177 179
178 InputDialog *fileDlg; 180 InputDialog *fileDlg;
179 fileDlg = new InputDialog(this,tr("Save output to file (name only)"),TRUE, 0); 181 fileDlg = new InputDialog(this,tr("Save output to file (name only)"),TRUE, 0);
180 fileDlg->exec(); 182 fileDlg->exec();
181 if( fileDlg->result() == 1 ) { 183 if( fileDlg->result() == 1 ) {
182 QString filename = QPEApplication::documentDir(); 184 QString filename = QPEApplication::documentDir();
183 if(filename.right(1).find('/') == -1) 185 if(filename.right(1).find('/') == -1)
184 filename+="/"; 186 filename+="/";
185 QString name = fileDlg->LineEdit1->text(); 187 QString name = fileDlg->LineEdit1->text();
186 filename+="text/plain/"+name; 188 filename+="text/plain/"+name;
187 qDebug(filename); 189 qDebug(filename);
188 190
189 QFile f(filename); 191 QFile f(filename);
190 f.open( IO_WriteOnly); 192 f.open( IO_WriteOnly);
191 if( f.writeBlock( OutputEdit->text(), qstrlen( OutputEdit->text()) ) != -1) { 193 if( f.writeBlock( OutputEdit->text(), qstrlen( OutputEdit->text()) ) != -1) {
192 DocLnk lnk; 194 DocLnk lnk;
193 lnk.setName(name); //sets file name 195 lnk.setName(name); //sets file name
194 lnk.setFile(filename); //sets File property 196 lnk.setFile(filename); //sets File property
195 lnk.setType("text/plain"); 197 lnk.setType("text/plain");
196 if(!lnk.writeLink()) { 198 if(!lnk.writeLink()) {
197 qDebug("Writing doclink did not work"); 199 qDebug("Writing doclink did not work");
198 } 200 }
199 } else 201 } else
200 qWarning("Could not write file"); 202 qWarning("Could not write file");
201 f.close(); 203 f.close();
202 } 204 }
203} 205}
204 206
205void Output::commandStdout(OProcess*, char *buffer, int buflen) { 207void Output::commandStdout(OProcess*, char *buffer, int buflen) {
206 qWarning("received stdout %d bytes", buflen); 208 qWarning("received stdout %d bytes", buflen);
207 209
208// QByteArray data(buflen); 210// QByteArray data(buflen);
209// data.fill(*buffer, buflen); 211// data.fill(*buffer, buflen);
210// for (uint i = 0; i < data.count(); i++ ) { 212// for (uint i = 0; i < data.count(); i++ ) {
211// printf("%c", buffer[i] ); 213// printf("%c", buffer[i] );
212// } 214// }
213// printf("\n"); 215// printf("\n");
214 216
215 QString lineStr = buffer; 217 QString lineStr = buffer;
216 lineStr=lineStr.left(lineStr.length()-1); 218 lineStr=lineStr.left(lineStr.length()-1);
217 OutputEdit->append(lineStr); 219 OutputEdit->append(lineStr);
218 OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE); 220 OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE);
219} 221}
220 222
221 223
222void Output::commandStdin( const QByteArray &data) { 224void Output::commandStdin( const QByteArray &data) {
223 qWarning("received stdin %d bytes", data.size()); 225 qWarning("received stdin %d bytes", data.size());
224 // recieved data from the io layer goes to sz 226 // recieved data from the io layer goes to sz
225 proc->writeStdin(data.data(), data.size()); 227 proc->writeStdin(data.data(), data.size());
226} 228}
227 229
228void Output::commandStderr(OProcess*, char *buffer, int buflen) { 230void Output::commandStderr(OProcess*, char *buffer, int buflen) {
229 qWarning("received stderrt %d bytes", buflen); 231 qWarning("received stderrt %d bytes", buflen);
230 232
231 QString lineStr = buffer; 233 QString lineStr = buffer;
232// lineStr=lineStr.left(lineStr.length()-1); 234// lineStr=lineStr.left(lineStr.length()-1);
233 OutputEdit->append(lineStr); 235 OutputEdit->append(lineStr);
234 OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE); 236 OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE);
235} 237}
236 238
237void Output::processFinished() { 239void Output::processFinished() {
238 240
239 delete proc; 241 delete proc;
240 OutputEdit->append( tr("\nFinished\n") ); 242 OutputEdit->append( tr("\nFinished\n") );
241 OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE); 243 OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE);
242// close(); 244// close();
243// disconnect( layer(), SIGNAL(received(const QByteArray&)), 245// disconnect( layer(), SIGNAL(received(const QByteArray&)),
244// this, SLOT(commandStdin(const QByteArray&))); 246// this, SLOT(commandStdin(const QByteArray&)));
245} 247}
246 248
247//============================== 249//==============================
248 250
249InputDialog::InputDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) 251InputDialog::InputDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
250 : QDialog( parent, name, modal, fl ) 252 : QDialog( parent, name, modal, fl )
251{ 253{
252 if ( !name ) 254 if ( !name )
253 setName( "InputDialog" ); 255 setName( "InputDialog" );
254 resize( 234, 50 ); 256 resize( 234, 50 );
255 setMaximumSize( QSize( 240, 50 ) ); 257 setMaximumSize( QSize( 240, 50 ) );
256 setCaption( tr(name ) ); 258 setCaption( tr(name ) );
257 259
258 LineEdit1 = new QLineEdit( this, "LineEdit1" ); 260 LineEdit1 = new QLineEdit( this, "LineEdit1" );
259 LineEdit1->setGeometry( QRect( 10, 10, 216, 22 ) ); 261 LineEdit1->setGeometry( QRect( 10, 10, 216, 22 ) );
260 LineEdit1->setFocus(); 262 LineEdit1->setFocus();
261 LineEdit1->setFocus(); 263 LineEdit1->setFocus();
262 connect(LineEdit1,SIGNAL(returnPressed()),this,SLOT(returned() )); 264 connect(LineEdit1,SIGNAL(returnPressed()),this,SLOT(returned() ));
263} 265}
264 266
265InputDialog::~InputDialog() { 267InputDialog::~InputDialog() {
266 inputText = LineEdit1->text(); 268 inputText = LineEdit1->text();
267} 269}
268 270
269void InputDialog::setInputText(const QString &string) { 271void InputDialog::setInputText(const QString &string) {
270 LineEdit1->setText( string); 272 LineEdit1->setText( string);
271} 273}
272 274
273void InputDialog::returned() { 275void InputDialog::returned() {
274 inputText = LineEdit1->text(); 276 inputText = LineEdit1->text();
275 this->accept(); 277 this->accept();
276} 278}
diff --git a/noncore/apps/advancedfm/output.h b/noncore/apps/advancedfm/output.h
index 26c0fa0..37ba57d 100644
--- a/noncore/apps/advancedfm/output.h
+++ b/noncore/apps/advancedfm/output.h
@@ -1,65 +1,65 @@
1/**************************************************************************** 1/****************************************************************************
2** Form interface generated from reading ui file 'outputEdit.ui' 2** Form interface generated from reading ui file 'outputEdit.ui'
3** 3**
4** Created: Fri Apr 12 15:12:44 2002 4** Created: Fri Apr 12 15:12:44 2002
5** by: The User Interface Compiler (uic) 5** by: The User Interface Compiler (uic)
6** 6**
7** WARNING! All changes made in this file will be lost! 7** WARNING! All changes made in this file will be lost!
8****************************************************************************/ 8****************************************************************************/
9#ifndef OUTPUT_H 9#ifndef OUTPUT_H
10#define OUTPUT_H 10#define OUTPUT_H
11 11
12#include <qvariant.h> 12#include <qvariant.h>
13#include <qdialog.h> 13#include <qdialog.h>
14#include <qcstring.h> 14#include <qcstring.h>
15#include <qstringlist.h> 15#include <qstringlist.h>
16#include <qlineedit.h> 16#include <qlineedit.h>
17#include <qwhatsthis.h> 17#include <qwhatsthis.h>
18 18
19#include <opie2/oprocess.h> 19#include <opie2/oprocess.h>
20 20
21class QVBoxLayout; 21class QVBoxLayout;
22class QHBoxLayout; 22class QHBoxLayout;
23class QGridLayout; 23class QGridLayout;
24class QMultiLineEdit; 24class QMultiLineEdit;
25 25
26class Output : public QDialog 26class Output : public QDialog
27{ 27{
28 Q_OBJECT 28 Q_OBJECT
29 29
30public: 30public:
31 Output(const QStringList commands=0, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); 31 Output(const QStringList commands=0, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
32 ~Output(); 32 ~Output();
33 33
34 QMultiLineEdit* OutputEdit; 34 QMultiLineEdit* OutputEdit;
35 35
36protected: 36protected:
37 QGridLayout* OutputLayout; 37 QGridLayout* OutputLayout;
38 OProcess *proc; 38 Opie::Core::OProcess *proc;
39protected slots: 39protected slots:
40 void saveOutput(); 40 void saveOutput();
41 void commandStdout(OProcess*, char *, int); 41 void commandStdout(Opie::Core::OProcess*, char *, int);
42 void commandStdin(const QByteArray &); 42 void commandStdin(const QByteArray &);
43 void commandStderr(OProcess*, char *, int); 43 void commandStderr(Opie::Core::OProcess*, char *, int);
44 void processFinished(); 44 void processFinished();
45 private: 45 private:
46 QString cmmd; 46 QString cmmd;
47 47
48}; 48};
49 49
50class InputDialog : public QDialog 50class InputDialog : public QDialog
51{ 51{
52 Q_OBJECT 52 Q_OBJECT
53 53
54public: 54public:
55 InputDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); 55 InputDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
56 ~InputDialog(); 56 ~InputDialog();
57 QString inputText; 57 QString inputText;
58 QLineEdit* LineEdit1; 58 QLineEdit* LineEdit1;
59 void setInputText(const QString &); 59 void setInputText(const QString &);
60private slots: 60private slots:
61 void returned(); 61 void returned();
62 62
63}; 63};
64 64
65#endif // OUTPUT_H 65#endif // OUTPUT_H
diff --git a/noncore/apps/checkbook/checkbook.cpp b/noncore/apps/checkbook/checkbook.cpp
index 1b933f2..706d970 100644
--- a/noncore/apps/checkbook/checkbook.cpp
+++ b/noncore/apps/checkbook/checkbook.cpp
@@ -1,252 +1,253 @@
1/* 1/*
2                This file is part of the OPIE Project 2                This file is part of the OPIE Project
3 =. 3 =.
4             .=l. Copyright (c) 2002 Dan Williams <drw@handhelds.org> 4             .=l. Copyright (c) 2002 Dan Williams <drw@handhelds.org>
5           .>+-= 5           .>+-=
6 _;:,     .>    :=|. This file is free software; you can 6 _;:,     .>    :=|. This file is free software; you can
7.> <`_,   >  .   <= redistribute it and/or modify it under 7.> <`_,   >  .   <= redistribute it and/or modify it under
8:`=1 )Y*s>-.--   : the terms of the GNU General Public 8:`=1 )Y*s>-.--   : the terms of the GNU General Public
9.="- .-=="i,     .._ License as published by the Free Software 9.="- .-=="i,     .._ License as published by the Free Software
10 - .   .-<_>     .<> Foundation; either version 2 of the License, 10 - .   .-<_>     .<> Foundation; either version 2 of the License,
11     ._= =}       : or (at your option) any later version. 11     ._= =}       : or (at your option) any later version.
12    .%`+i>       _;_. 12    .%`+i>       _;_.
13    .i_,=:_.      -<s. This file is distributed in the hope that 13    .i_,=:_.      -<s. This file is distributed in the hope that
14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
15    : ..    .:,     . . . without even the implied warranty of 15    : ..    .:,     . . . without even the implied warranty of
16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
18..}^=.=       =       ; Public License for more details. 18..}^=.=       =       ; Public License for more details.
19++=   -.     .`     .: 19++=   -.     .`     .:
20 :     =  ...= . :.=- You should have received a copy of the GNU 20 :     =  ...= . :.=- You should have received a copy of the GNU
21 -.   .:....=;==+<; General Public License along with this file; 21 -.   .:....=;==+<; General Public License along with this file;
22  -_. . .   )=.  = see the file COPYING. If not, write to the 22  -_. . .   )=.  = see the file COPYING. If not, write to the
23    --        :-=` Free Software Foundation, Inc., 23    --        :-=` Free Software Foundation, Inc.,
24 59 Temple Place - Suite 330, 24 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28 28
29#include "checkbook.h" 29#include "checkbook.h"
30#include "cbinfo.h" 30#include "cbinfo.h"
31#include "transaction.h" 31#include "transaction.h"
32#include "traninfo.h" 32#include "traninfo.h"
33#include "graph.h" 33#include "graph.h"
34#include "graphinfo.h" 34#include "graphinfo.h"
35#include "password.h" 35#include "password.h"
36#include "cfg.h" 36#include "cfg.h"
37 37
38#include <qpe/qpeapplication.h> 38#include <qpe/qpeapplication.h>
39#include <qpe/qpemessagebox.h> 39#include <qpe/qpemessagebox.h>
40#include <qpe/resource.h> 40#include <qpe/resource.h>
41 41
42#include <qcheckbox.h> 42#include <qcheckbox.h>
43#include <qcombobox.h> 43#include <qcombobox.h>
44#include <qlabel.h> 44#include <qlabel.h>
45#include <qlayout.h> 45#include <qlayout.h>
46#include <qlineedit.h> 46#include <qlineedit.h>
47#include <qmultilineedit.h> 47#include <qmultilineedit.h>
48#include <qpushbutton.h> 48#include <qpushbutton.h>
49#include <qwhatsthis.h> 49#include <qwhatsthis.h>
50#include <qpopupmenu.h> 50#include <qpopupmenu.h>
51 51
52#define COL_ID 0 52#define COL_ID 0
53#define COL_SORTDATE 1 53#define COL_SORTDATE 1
54#define COL_NUM 2 54#define COL_NUM 2
55#define COL_DATE 3 55#define COL_DATE 3
56#define COL_DESC 4 56#define COL_DESC 4
57#define COL_AMOUNT 5 57#define COL_AMOUNT 5
58#define COL_BAL 6 58#define COL_BAL 6
59 59
60// --- Checkbook -------------------------------------------------------------- 60// --- Checkbook --------------------------------------------------------------
61using namespace Opie::Ui;
61Checkbook::Checkbook( QWidget *parent, CBInfo *i, Cfg *cfg ) 62Checkbook::Checkbook( QWidget *parent, CBInfo *i, Cfg *cfg )
62 : QDialog( parent, 0, TRUE, WStyle_ContextHelp ) 63 : QDialog( parent, 0, TRUE, WStyle_ContextHelp )
63{ 64{
64 info = i; 65 info = i;
65 _pCfg=cfg; 66 _pCfg=cfg;
66 67
67 // Title bar 68 // Title bar
68 if ( info->name() != "" ) 69 if ( info->name() != "" )
69 { 70 {
70 QString tempstr = info->name(); 71 QString tempstr = info->name();
71 tempstr.append( " - " ); 72 tempstr.append( " - " );
72 tempstr.append( tr( "Checkbook" ) ); 73 tempstr.append( tr( "Checkbook" ) );
73 setCaption( tempstr ); 74 setCaption( tempstr );
74 } 75 }
75 else 76 else
76 { 77 {
77 setCaption( tr( "New checkbook" ) ); 78 setCaption( tr( "New checkbook" ) );
78 } 79 }
79 80
80 81
81 // Setup layout to make everything pretty 82 // Setup layout to make everything pretty
82 QVBoxLayout *layout = new QVBoxLayout( this ); 83 QVBoxLayout *layout = new QVBoxLayout( this );
83 layout->setMargin( 2 ); 84 layout->setMargin( 2 );
84 layout->setSpacing( 4 ); 85 layout->setSpacing( 4 );
85 86
86 // Setup tabs for all info 87 // Setup tabs for all info
87 mainWidget = new OTabWidget( this ); 88 mainWidget = new OTabWidget( this );
88 layout->addWidget( mainWidget ); 89 layout->addWidget( mainWidget );
89 mainWidget->addTab( initInfo(), "checkbook/infotab", tr( "Info" ) ); 90 mainWidget->addTab( initInfo(), "checkbook/infotab", tr( "Info" ) );
90 mainWidget->addTab( initTransactions(), "checkbook/trantab", tr( "Transactions" ) ); 91 mainWidget->addTab( initTransactions(), "checkbook/trantab", tr( "Transactions" ) );
91 mainWidget->addTab( initCharts(), "checkbook/charttab", tr( "Charts" ) ); 92 mainWidget->addTab( initCharts(), "checkbook/charttab", tr( "Charts" ) );
92 if( _pCfg->isShowLastTab() ) 93 if( _pCfg->isShowLastTab() )
93 mainWidget->setCurrentTab( info->getLastTab() ); 94 mainWidget->setCurrentTab( info->getLastTab() );
94 else 95 else
95 mainWidget->setCurrentTab( tr( "Info" ) ); 96 mainWidget->setCurrentTab( tr( "Info" ) );
96 connect( mainWidget, SIGNAL( currentChanged(QWidget*) ), this, SLOT( slotTab(QWidget*) ) ); 97 connect( mainWidget, SIGNAL( currentChanged(QWidget*) ), this, SLOT( slotTab(QWidget*) ) );
97 98
98 // Load checkbook information 99 // Load checkbook information
99 loadCheckbook(); 100 loadCheckbook();
100} 101}
101 102
102Checkbook::~Checkbook() 103Checkbook::~Checkbook()
103{ 104{
104} 105}
105 106
106// --- initInfo --------------------------------------------------------------- 107// --- initInfo ---------------------------------------------------------------
107QWidget *Checkbook::initInfo() 108QWidget *Checkbook::initInfo()
108{ 109{
109 QWidget *control = new QWidget( mainWidget, tr("Info") ); 110 QWidget *control = new QWidget( mainWidget, tr("Info") );
110 111
111 QVBoxLayout *vb = new QVBoxLayout( control ); 112 QVBoxLayout *vb = new QVBoxLayout( control );
112 113
113 QScrollView *sv = new QScrollView( control ); 114 QScrollView *sv = new QScrollView( control );
114 vb->addWidget( sv, 0, 0 ); 115 vb->addWidget( sv, 0, 0 );
115 sv->setResizePolicy( QScrollView::AutoOneFit ); 116 sv->setResizePolicy( QScrollView::AutoOneFit );
116 sv->setFrameStyle( QFrame::NoFrame ); 117 sv->setFrameStyle( QFrame::NoFrame );
117 118
118 QWidget *container = new QWidget( sv->viewport() ); 119 QWidget *container = new QWidget( sv->viewport() );
119 sv->addChild( container ); 120 sv->addChild( container );
120 121
121 QGridLayout *layout = new QGridLayout( container ); 122 QGridLayout *layout = new QGridLayout( container );
122 layout->setSpacing( 2 ); 123 layout->setSpacing( 2 );
123 layout->setMargin( 4 ); 124 layout->setMargin( 4 );
124 125
125 // Password protection 126 // Password protection
126 passwordCB = new QCheckBox( tr( "Password protect" ), container ); 127 passwordCB = new QCheckBox( tr( "Password protect" ), container );
127 QWhatsThis::add( passwordCB, tr( "Click here to enable/disable password protection of this checkbook." ) ); 128 QWhatsThis::add( passwordCB, tr( "Click here to enable/disable password protection of this checkbook." ) );
128 connect( passwordCB, SIGNAL( clicked() ), this, SLOT( slotPasswordClicked() ) ); 129 connect( passwordCB, SIGNAL( clicked() ), this, SLOT( slotPasswordClicked() ) );
129 layout->addMultiCellWidget( passwordCB, 0, 0, 0, 1 ); 130 layout->addMultiCellWidget( passwordCB, 0, 0, 0, 1 );
130 131
131 // Account name 132 // Account name
132 QLabel *label = new QLabel( tr( "Name:" ), container ); 133 QLabel *label = new QLabel( tr( "Name:" ), container );
133 QWhatsThis::add( label, tr( "Enter name of checkbook here." ) ); 134 QWhatsThis::add( label, tr( "Enter name of checkbook here." ) );
134 layout->addWidget( label, 1, 0 ); 135 layout->addWidget( label, 1, 0 );
135 nameEdit = new QLineEdit( container ); 136 nameEdit = new QLineEdit( container );
136 QWhatsThis::add( nameEdit, tr( "Enter name of checkbook here." ) ); 137 QWhatsThis::add( nameEdit, tr( "Enter name of checkbook here." ) );
137 connect( nameEdit, SIGNAL( textChanged(const QString&) ), 138 connect( nameEdit, SIGNAL( textChanged(const QString&) ),
138 this, SLOT( slotNameChanged(const QString&) ) ); 139 this, SLOT( slotNameChanged(const QString&) ) );
139 layout->addWidget( nameEdit, 1, 1 ); 140 layout->addWidget( nameEdit, 1, 1 );
140 141
141 // Type of account 142 // Type of account
142 label = new QLabel( tr( "Type:" ), container ); 143 label = new QLabel( tr( "Type:" ), container );
143 QWhatsThis::add( label, tr( "Select type of checkbook here." ) ); 144 QWhatsThis::add( label, tr( "Select type of checkbook here." ) );
144 layout->addWidget( label, 2, 0 ); 145 layout->addWidget( label, 2, 0 );
145 typeList = new QComboBox( container ); 146 typeList = new QComboBox( container );
146 QWhatsThis::add( typeList, tr( "Select type of checkbook here." ) ); 147 QWhatsThis::add( typeList, tr( "Select type of checkbook here." ) );
147 typeList->insertStringList( _pCfg->getAccountTypes() ); 148 typeList->insertStringList( _pCfg->getAccountTypes() );
148 layout->addWidget( typeList, 2, 1 ); 149 layout->addWidget( typeList, 2, 1 );
149 150
150 // Bank/institution name 151 // Bank/institution name
151 label = new QLabel( tr( "Bank:" ), container ); 152 label = new QLabel( tr( "Bank:" ), container );
152 QWhatsThis::add( label, tr( "Enter name of the bank for this checkbook here." ) ); 153 QWhatsThis::add( label, tr( "Enter name of the bank for this checkbook here." ) );
153 layout->addWidget( label, 3, 0 ); 154 layout->addWidget( label, 3, 0 );
154 bankEdit = new QLineEdit( container ); 155 bankEdit = new QLineEdit( container );
155 QWhatsThis::add( bankEdit, tr( "Enter name of the bank for this checkbook here." ) ); 156 QWhatsThis::add( bankEdit, tr( "Enter name of the bank for this checkbook here." ) );
156 layout->addWidget( bankEdit, 3, 1 ); 157 layout->addWidget( bankEdit, 3, 1 );
157 158
158 // Account number 159 // Account number
159 label = new QLabel( tr( "Account number:" ), container ); 160 label = new QLabel( tr( "Account number:" ), container );
160 QWhatsThis::add( label, tr( "Enter account number for this checkbook here." ) ); 161 QWhatsThis::add( label, tr( "Enter account number for this checkbook here." ) );
161 layout->addWidget( label, 4, 0 ); 162 layout->addWidget( label, 4, 0 );
162 acctNumEdit = new QLineEdit( container ); 163 acctNumEdit = new QLineEdit( container );
163 QWhatsThis::add( acctNumEdit, tr( "Enter account number for this checkbook here." ) ); 164 QWhatsThis::add( acctNumEdit, tr( "Enter account number for this checkbook here." ) );
164 layout->addWidget( acctNumEdit, 4, 1 ); 165 layout->addWidget( acctNumEdit, 4, 1 );
165 166
166 // PIN number 167 // PIN number
167 label = new QLabel( tr( "PIN number:" ), container ); 168 label = new QLabel( tr( "PIN number:" ), container );
168 QWhatsThis::add( label, tr( "Enter PIN number for this checkbook here." ) ); 169 QWhatsThis::add( label, tr( "Enter PIN number for this checkbook here." ) );
169 layout->addWidget( label, 5, 0 ); 170 layout->addWidget( label, 5, 0 );
170 pinNumEdit = new QLineEdit( container ); 171 pinNumEdit = new QLineEdit( container );
171 QWhatsThis::add( pinNumEdit, tr( "Enter PIN number for this checkbook here." ) ); 172 QWhatsThis::add( pinNumEdit, tr( "Enter PIN number for this checkbook here." ) );
172 layout->addWidget( pinNumEdit, 5, 1 ); 173 layout->addWidget( pinNumEdit, 5, 1 );
173 174
174 // Starting balance 175 // Starting balance
175 label = new QLabel( tr( "Starting balance:" ), container ); 176 label = new QLabel( tr( "Starting balance:" ), container );
176 QWhatsThis::add( label, tr( "Enter the initial balance for this checkbook here." ) ); 177 QWhatsThis::add( label, tr( "Enter the initial balance for this checkbook here." ) );
177 layout->addWidget( label, 6, 0 ); 178 layout->addWidget( label, 6, 0 );
178 balanceEdit = new QLineEdit( container ); 179 balanceEdit = new QLineEdit( container );
179 QWhatsThis::add( balanceEdit, tr( "Enter the initial balance for this checkbook here." ) ); 180 QWhatsThis::add( balanceEdit, tr( "Enter the initial balance for this checkbook here." ) );
180 connect( balanceEdit, SIGNAL( textChanged(const QString&) ), 181 connect( balanceEdit, SIGNAL( textChanged(const QString&) ),
181 this, SLOT( slotStartingBalanceChanged(const QString&) ) ); 182 this, SLOT( slotStartingBalanceChanged(const QString&) ) );
182 layout->addWidget( balanceEdit, 6, 1 ); 183 layout->addWidget( balanceEdit, 6, 1 );
183 184
184 // Notes 185 // Notes
185 label = new QLabel( tr( "Notes:" ), container ); 186 label = new QLabel( tr( "Notes:" ), container );
186 QWhatsThis::add( label, tr( "Enter any additional information for this checkbook here." ) ); 187 QWhatsThis::add( label, tr( "Enter any additional information for this checkbook here." ) );
187 layout->addWidget( label, 7, 0 ); 188 layout->addWidget( label, 7, 0 );
188 notesEdit = new QMultiLineEdit( container ); 189 notesEdit = new QMultiLineEdit( container );
189 QWhatsThis::add( notesEdit, tr( "Enter any additional information for this checkbook here." ) ); 190 QWhatsThis::add( notesEdit, tr( "Enter any additional information for this checkbook here." ) );
190 notesEdit->setMinimumHeight( 25 ); 191 notesEdit->setMinimumHeight( 25 );
191 notesEdit->setMaximumHeight( 65 ); 192 notesEdit->setMaximumHeight( 65 );
192 layout->addMultiCellWidget( notesEdit, 8, 8, 0, 1 ); 193 layout->addMultiCellWidget( notesEdit, 8, 8, 0, 1 );
193 194
194 return control; 195 return control;
195} 196}
196 197
197 198
198// --- initTransactions ------------------------------------------------------- 199// --- initTransactions -------------------------------------------------------
199QWidget *Checkbook::initTransactions() 200QWidget *Checkbook::initTransactions()
200{ 201{
201 QWidget *control = new QWidget( mainWidget, tr("Transactions") ); 202 QWidget *control = new QWidget( mainWidget, tr("Transactions") );
202 203
203 QGridLayout *layout = new QGridLayout( control ); 204 QGridLayout *layout = new QGridLayout( control );
204 layout->setSpacing( 2 ); 205 layout->setSpacing( 2 );
205 layout->setMargin( 4 ); 206 layout->setMargin( 4 );
206 207
207 // Sort selector 208 // Sort selector
208 QLabel *label = new QLabel( tr( "Sort by:" ), control ); 209 QLabel *label = new QLabel( tr( "Sort by:" ), control );
209 QWhatsThis::add( label, tr( "Select checkbook sorting here." ) ); 210 QWhatsThis::add( label, tr( "Select checkbook sorting here." ) );
210 layout->addMultiCellWidget( label, 0, 0, 0, 1 ); 211 layout->addMultiCellWidget( label, 0, 0, 0, 1 );
211 _cbSortType=new QComboBox( control ); 212 _cbSortType=new QComboBox( control );
212 _cbSortType->insertItem( tr("Entry Order") ); 213 _cbSortType->insertItem( tr("Entry Order") );
213 _cbSortType->insertItem( tr("Date") ); 214 _cbSortType->insertItem( tr("Date") );
214 _cbSortType->insertItem( tr("Number") ); 215 _cbSortType->insertItem( tr("Number") );
215 layout->addMultiCellWidget( _cbSortType, 0, 0, 1, 2 ); 216 layout->addMultiCellWidget( _cbSortType, 0, 0, 1, 2 );
216 connect( _cbSortType, SIGNAL( activated(const QString&) ), this, SLOT( slotSortChanged(const QString&) ) ); 217 connect( _cbSortType, SIGNAL( activated(const QString&) ), this, SLOT( slotSortChanged(const QString&) ) );
217 218
218 // Table 219 // Table
219 tranTable = new QListView( control ); 220 tranTable = new QListView( control );
220 QFont fnt(QPEApplication::font()); 221 QFont fnt(QPEApplication::font());
221 fnt.setPointSize( fnt.pointSize()-1 ); 222 fnt.setPointSize( fnt.pointSize()-1 );
222 tranTable->setFont( fnt ); 223 tranTable->setFont( fnt );
223 QWhatsThis::add( tranTable, tr( "This is a listing of all transactions entered for this checkbook.\n\nTo sort entries by a specific field, click on the column name." ) ); 224 QWhatsThis::add( tranTable, tr( "This is a listing of all transactions entered for this checkbook.\n\nTo sort entries by a specific field, click on the column name." ) );
224 tranTable->addColumn( tr( "Id" ) ); 225 tranTable->addColumn( tr( "Id" ) );
225 tranTable->setColumnWidthMode( COL_ID, QListView::Manual ); 226 tranTable->setColumnWidthMode( COL_ID, QListView::Manual );
226 tranTable->setColumnWidth( COL_ID, 0); 227 tranTable->setColumnWidth( COL_ID, 0);
227 tranTable->addColumn( tr( "SortDate" ) ); 228 tranTable->addColumn( tr( "SortDate" ) );
228 tranTable->setColumnWidthMode( COL_SORTDATE, QListView::Manual ); 229 tranTable->setColumnWidthMode( COL_SORTDATE, QListView::Manual );
229 tranTable->setColumnWidth( COL_SORTDATE, 0); 230 tranTable->setColumnWidth( COL_SORTDATE, 0);
230 tranTable->addColumn( tr( "Num" ) ); 231 tranTable->addColumn( tr( "Num" ) );
231 tranTable->addColumn( tr( "Date" ) ); 232 tranTable->addColumn( tr( "Date" ) );
232 //tranTable->addColumn( tr( "Cleared" ) ); 233 //tranTable->addColumn( tr( "Cleared" ) );
233 tranTable->addColumn( tr( "Description" ) ); 234 tranTable->addColumn( tr( "Description" ) );
234 int column = tranTable->addColumn( tr( "Amount" ) ); 235 int column = tranTable->addColumn( tr( "Amount" ) );
235 tranTable->setColumnAlignment( column, Qt::AlignRight ); 236 tranTable->setColumnAlignment( column, Qt::AlignRight );
236 column=tranTable->addColumn( tr("Balance") ); 237 column=tranTable->addColumn( tr("Balance") );
237 tranTable->setColumnAlignment( column, Qt::AlignRight ); 238 tranTable->setColumnAlignment( column, Qt::AlignRight );
238 tranTable->setAllColumnsShowFocus( TRUE ); 239 tranTable->setAllColumnsShowFocus( TRUE );
239 tranTable->setSorting( -1 ); 240 tranTable->setSorting( -1 );
240 layout->addMultiCellWidget( tranTable, 1, 1, 0, 2 ); 241 layout->addMultiCellWidget( tranTable, 1, 1, 0, 2 );
241 QPEApplication::setStylusOperation( tranTable->viewport(), QPEApplication::RightOnHold ); 242 QPEApplication::setStylusOperation( tranTable->viewport(), QPEApplication::RightOnHold );
242 connect( tranTable, SIGNAL( rightButtonPressed(QListViewItem*,const QPoint&,int) ), 243 connect( tranTable, SIGNAL( rightButtonPressed(QListViewItem*,const QPoint&,int) ),
243 this, SLOT( slotMenuTran(QListViewItem*,const QPoint&) ) ); 244 this, SLOT( slotMenuTran(QListViewItem*,const QPoint&) ) );
244 connect( tranTable, SIGNAL( doubleClicked(QListViewItem*) ), 245 connect( tranTable, SIGNAL( doubleClicked(QListViewItem*) ),
245 this, SLOT( slotEditTran() ) ); 246 this, SLOT( slotEditTran() ) );
246 _sortCol=COL_ID; 247 _sortCol=COL_ID;
247 248
248 // Buttons 249 // Buttons
249 QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), control ); 250 QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), control );
250 QWhatsThis::add( btn, tr( "Click here to add a new transaction." ) ); 251 QWhatsThis::add( btn, tr( "Click here to add a new transaction." ) );
251 connect( btn, SIGNAL( clicked() ), this, SLOT( slotNewTran() ) ); 252 connect( btn, SIGNAL( clicked() ), this, SLOT( slotNewTran() ) );
252 layout->addWidget( btn, 2, 0 ); 253 layout->addWidget( btn, 2, 0 );
diff --git a/noncore/apps/checkbook/checkbook.h b/noncore/apps/checkbook/checkbook.h
index e2f0e56..80bc106 100644
--- a/noncore/apps/checkbook/checkbook.h
+++ b/noncore/apps/checkbook/checkbook.h
@@ -1,150 +1,149 @@
1/* 1/*
2                This file is part of the OPIE Project 2                This file is part of the OPIE Project
3 =. 3 =.
4             .=l. Copyright (c) 2002 Dan Williams <drw@handhelds.org> 4             .=l. Copyright (c) 2002 Dan Williams <drw@handhelds.org>
5           .>+-= 5           .>+-=
6 _;:,     .>    :=|. This file is free software; you can 6 _;:,     .>    :=|. This file is free software; you can
7.> <`_,   >  .   <= redistribute it and/or modify it under 7.> <`_,   >  .   <= redistribute it and/or modify it under
8:`=1 )Y*s>-.--   : the terms of the GNU General Public 8:`=1 )Y*s>-.--   : the terms of the GNU General Public
9.="- .-=="i,     .._ License as published by the Free Software 9.="- .-=="i,     .._ License as published by the Free Software
10 - .   .-<_>     .<> Foundation; either version 2 of the License, 10 - .   .-<_>     .<> Foundation; either version 2 of the License,
11     ._= =}       : or (at your option) any later version. 11     ._= =}       : or (at your option) any later version.
12    .%`+i>       _;_. 12    .%`+i>       _;_.
13    .i_,=:_.      -<s. This file is distributed in the hope that 13    .i_,=:_.      -<s. This file is distributed in the hope that
14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
15    : ..    .:,     . . . without even the implied warranty of 15    : ..    .:,     . . . without even the implied warranty of
16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
18..}^=.=       =       ; Public License for more details. 18..}^=.=       =       ; Public License for more details.
19++=   -.     .`     .: 19++=   -.     .`     .:
20 :     =  ...= . :.=- You should have received a copy of the GNU 20 :     =  ...= . :.=- You should have received a copy of the GNU
21 -.   .:....=;==+<; General Public License along with this file; 21 -.   .:....=;==+<; General Public License along with this file;
22  -_. . .   )=.  = see the file COPYING. If not, write to the 22  -_. . .   )=.  = see the file COPYING. If not, write to the
23    --        :-=` Free Software Foundation, Inc., 23    --        :-=` Free Software Foundation, Inc.,
24 59 Temple Place - Suite 330, 24 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28 28
29#ifndef CHECKBOOK_H 29#ifndef CHECKBOOK_H
30#define CHECKBOOK_H 30#define CHECKBOOK_H
31 31
32#include <opie2/otabwidget.h> 32#include <opie2/otabwidget.h>
33 33
34#include <qdatetime.h> 34#include <qdatetime.h>
35#include <qdialog.h> 35#include <qdialog.h>
36#include <qlistview.h> 36#include <qlistview.h>
37 37
38using Opie::OTabWidget;
39 38
40class CBInfo; 39class CBInfo;
41class Graph; 40class Graph;
42class GraphInfo; 41class GraphInfo;
43class QCheckBox; 42class QCheckBox;
44class QComboBox; 43class QComboBox;
45class QLabel; 44class QLabel;
46class QLineEdit; 45class QLineEdit;
47class QListView; 46class QListView;
48class QMultiLineEdit; 47class QMultiLineEdit;
49class QString; 48class QString;
50class TranInfo; 49class TranInfo;
51class TranInfoList; 50class TranInfoList;
52class Cfg; 51class Cfg;
53class QMouseEvent; 52class QMouseEvent;
54 53
55 54
56// --- Checkbook -------------------------------------------------------------- 55// --- Checkbook --------------------------------------------------------------
57class Checkbook : public QDialog 56class Checkbook : public QDialog
58{ 57{
59 Q_OBJECT 58 Q_OBJECT
60 59
61 public: 60 public:
62 Checkbook( QWidget *, CBInfo *, Cfg *cfg ); 61 Checkbook( QWidget *, CBInfo *, Cfg *cfg );
63 ~Checkbook(); 62 ~Checkbook();
64 63
65 // resort 64 // resort
66 void resort(); 65 void resort();
67 66
68 // members 67 // members
69 TranInfoList *getTranList() { return(tranList); } 68 TranInfoList *getTranList() { return(tranList); }
70 69
71 private: 70 private:
72 CBInfo *info; 71 CBInfo *info;
73 TranInfoList *tranList; 72 TranInfoList *tranList;
74 Cfg *_pCfg; 73 Cfg *_pCfg;
75 74
76 OTabWidget *mainWidget; 75 Opie::Ui::OTabWidget *mainWidget;
77 void loadCheckbook(); 76 void loadCheckbook();
78 void adjustBalance(); 77 void adjustBalance();
79 78
80 // Info tab 79 // Info tab
81 QWidget *initInfo(); 80 QWidget *initInfo();
82 QCheckBox *passwordCB; 81 QCheckBox *passwordCB;
83 QLineEdit *nameEdit; 82 QLineEdit *nameEdit;
84 QComboBox *typeList; 83 QComboBox *typeList;
85 QLineEdit *bankEdit; 84 QLineEdit *bankEdit;
86 QLineEdit *acctNumEdit; 85 QLineEdit *acctNumEdit;
87 QLineEdit *pinNumEdit; 86 QLineEdit *pinNumEdit;
88 QLineEdit *balanceEdit; 87 QLineEdit *balanceEdit;
89 QMultiLineEdit *notesEdit; 88 QMultiLineEdit *notesEdit;
90 int _sortCol; 89 int _sortCol;
91 90
92 // Transactions tab 91 // Transactions tab
93 QWidget *initTransactions(); 92 QWidget *initTransactions();
94 QListView *tranTable; 93 QListView *tranTable;
95 QComboBox *_cbSortType; 94 QComboBox *_cbSortType;
96 QDate _dLastNew; 95 QDate _dLastNew;
97 96
98 // Charts tab 97 // Charts tab
99 QWidget *initCharts(); 98 QWidget *initCharts();
100 GraphInfo *graphInfo; 99 GraphInfo *graphInfo;
101 QComboBox *graphList; 100 QComboBox *graphList;
102 Graph *graphWidget; 101 Graph *graphWidget;
103 102
104 void drawBalanceChart(); 103 void drawBalanceChart();
105 void drawCategoryChart( bool = TRUE ); 104 void drawCategoryChart( bool = TRUE );
106 105
107 106
108 protected slots: 107 protected slots:
109 void accept(); 108 void accept();
110 void slotTab(QWidget *tab); 109 void slotTab(QWidget *tab);
111 110
112 private slots: 111 private slots:
113 void slotPasswordClicked(); 112 void slotPasswordClicked();
114 void slotNameChanged( const QString & ); 113 void slotNameChanged( const QString & );
115 void slotStartingBalanceChanged( const QString & ); 114 void slotStartingBalanceChanged( const QString & );
116 void slotNewTran(); 115 void slotNewTran();
117 void slotEditTran(); 116 void slotEditTran();
118 void slotMenuTran(QListViewItem *, const QPoint &); 117 void slotMenuTran(QListViewItem *, const QPoint &);
119 void slotDeleteTran(); 118 void slotDeleteTran();
120 void slotDrawGraph(); 119 void slotDrawGraph();
121 void slotSortChanged( const QString & ); 120 void slotSortChanged( const QString & );
122}; 121};
123 122
124 123
125// --- CBListItem ------------------------------------------------------------- 124// --- CBListItem -------------------------------------------------------------
126class CBListItem : public QListViewItem 125class CBListItem : public QListViewItem
127{ 126{
128 //Q_OBJECT 127 //Q_OBJECT
129 128
130 public: 129 public:
131 CBListItem( TranInfo *, QListView *, QString = QString::null, QString = QString::null, 130 CBListItem( TranInfo *, QListView *, QString = QString::null, QString = QString::null,
132 QString = QString::null, QString = QString::null, QString = QString::null, 131 QString = QString::null, QString = QString::null, QString = QString::null,
133 QString = QString::null, QString = QString::null, QString = QString::null ); 132 QString = QString::null, QString = QString::null, QString = QString::null );
134 133
135 void paintCell( QPainter *, const QColorGroup &, int, int, int ); 134 void paintCell( QPainter *, const QColorGroup &, int, int, int );
136 135
137 // --- members 136 // --- members
138 TranInfo *getTranInfo() { return(_pTran); } 137 TranInfo *getTranInfo() { return(_pTran); }
139 138
140 private: 139 private:
141 TranInfo *_pTran; 140 TranInfo *_pTran;
142 QListView *owner; 141 QListView *owner;
143 bool m_known; 142 bool m_known;
144 bool m_odd; 143 bool m_odd;
145 144
146 bool isAltBackground(); 145 bool isAltBackground();
147}; 146};
148 147
149 148
150#endif 149#endif
diff --git a/noncore/apps/checkbook/main.cpp b/noncore/apps/checkbook/main.cpp
index 0384620..1135bee 100644
--- a/noncore/apps/checkbook/main.cpp
+++ b/noncore/apps/checkbook/main.cpp
@@ -1,33 +1,35 @@
1/* 1/*
2                This file is part of the OPIE Project 2                This file is part of the OPIE Project
3 =. 3 =.
4             .=l. Copyright (c) 2002 Dan Williams <drw@handhelds.org> 4             .=l. Copyright (c) 2002 Dan Williams <drw@handhelds.org>
5           .>+-= 5           .>+-=
6 _;:,     .>    :=|. This file is free software; you can 6 _;:,     .>    :=|. This file is free software; you can
7.> <`_,   >  .   <= redistribute it and/or modify it under 7.> <`_,   >  .   <= redistribute it and/or modify it under
8:`=1 )Y*s>-.--   : the terms of the GNU General Public 8:`=1 )Y*s>-.--   : the terms of the GNU General Public
9.="- .-=="i,     .._ License as published by the Free Software 9.="- .-=="i,     .._ License as published by the Free Software
10 - .   .-<_>     .<> Foundation; either version 2 of the License, 10 - .   .-<_>     .<> Foundation; either version 2 of the License,
11     ._= =}       : or (at your option) any later version. 11     ._= =}       : or (at your option) any later version.
12    .%`+i>       _;_. 12    .%`+i>       _;_.
13    .i_,=:_.      -<s. This file is distributed in the hope that 13    .i_,=:_.      -<s. This file is distributed in the hope that
14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
15    : ..    .:,     . . . without even the implied warranty of 15    : ..    .:,     . . . without even the implied warranty of
16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
18..}^=.=       =       ; Public License for more details. 18..}^=.=       =       ; Public License for more details.
19++=   -.     .`     .: 19++=   -.     .`     .:
20 :     =  ...= . :.=- You should have received a copy of the GNU 20 :     =  ...= . :.=- You should have received a copy of the GNU
21 -.   .:....=;==+<; General Public License along with this file; 21 -.   .:....=;==+<; General Public License along with this file;
22  -_. . .   )=.  = see the file COPYING. If not, write to the 22  -_. . .   )=.  = see the file COPYING. If not, write to the
23    --        :-=` Free Software Foundation, Inc., 23    --        :-=` Free Software Foundation, Inc.,
24 59 Temple Place - Suite 330, 24 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28 28
29#include <opie2/oapplicationfactory.h> 29#include <opie2/oapplicationfactory.h>
30 30
31using namespace Opie::Core;
32using namespace Opie::Core;
31#include "mainwindow.h" 33#include "mainwindow.h"
32 34
33OPIE_EXPORT_APP( OApplicationFactory<MainWindow> ) 35OPIE_EXPORT_APP( OApplicationFactory<MainWindow> )
diff --git a/noncore/apps/checkbook/mainwindow.cpp b/noncore/apps/checkbook/mainwindow.cpp
index 254ce6a..ce15e3e 100644
--- a/noncore/apps/checkbook/mainwindow.cpp
+++ b/noncore/apps/checkbook/mainwindow.cpp
@@ -1,230 +1,230 @@
1/* 1/*
2                This file is part of the OPIE Project 2                This file is part of the OPIE Project
3 =. 3 =.
4             .=l. Copyright (c) 2002 Dan Williams <drw@handhelds.org> 4             .=l. Copyright (c) 2002 Dan Williams <drw@handhelds.org>
5           .>+-= 5           .>+-=
6 _;:,     .>    :=|. This file is free software; you can 6 _;:,     .>    :=|. This file is free software; you can
7.> <`_,   >  .   <= redistribute it and/or modify it under 7.> <`_,   >  .   <= redistribute it and/or modify it under
8:`=1 )Y*s>-.--   : the terms of the GNU General Public 8:`=1 )Y*s>-.--   : the terms of the GNU General Public
9.="- .-=="i,     .._ License as published by the Free Software 9.="- .-=="i,     .._ License as published by the Free Software
10 - .   .-<_>     .<> Foundation; either version 2 of the License, 10 - .   .-<_>     .<> Foundation; either version 2 of the License,
11     ._= =}       : or (at your option) any later version. 11     ._= =}       : or (at your option) any later version.
12    .%`+i>       _;_. 12    .%`+i>       _;_.
13    .i_,=:_.      -<s. This file is distributed in the hope that 13    .i_,=:_.      -<s. This file is distributed in the hope that
14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
15    : ..    .:,     . . . without even the implied warranty of 15    : ..    .:,     . . . without even the implied warranty of
16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
18..}^=.=       =       ; Public License for more details. 18..}^=.=       =       ; Public License for more details.
19++=   -.     .`     .: 19++=   -.     .`     .:
20 :     =  ...= . :.=- You should have received a copy of the GNU 20 :     =  ...= . :.=- You should have received a copy of the GNU
21 -.   .:....=;==+<; General Public License along with this file; 21 -.   .:....=;==+<; General Public License along with this file;
22  -_. . .   )=.  = see the file COPYING. If not, write to the 22  -_. . .   )=.  = see the file COPYING. If not, write to the
23    --        :-=` Free Software Foundation, Inc., 23    --        :-=` Free Software Foundation, Inc.,
24 59 Temple Place - Suite 330, 24 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28 28
29#include "mainwindow.h" 29#include "mainwindow.h"
30#include "cbinfo.h" 30#include "cbinfo.h"
31#include "configuration.h" 31#include "configuration.h"
32#include "password.h" 32#include "password.h"
33#include "checkbook.h" 33#include "checkbook.h"
34 34
35#include <qpe/config.h> 35#include <qpe/config.h>
36#include <qpe/qpeapplication.h> 36#include <qpe/qpeapplication.h>
37#include <qpe/qpemessagebox.h> 37#include <qpe/qpemessagebox.h>
38#include <qpe/qpetoolbar.h> 38#include <qtoolbar.h>
39#include <qpe/resource.h> 39#include <qpe/resource.h>
40 40
41#include <qmenubar.h> 41#include <qmenubar.h>
42#include <qaction.h> 42#include <qaction.h>
43#include <qdir.h> 43#include <qdir.h>
44#include <qwhatsthis.h> 44#include <qwhatsthis.h>
45 45
46 46
47MainWindow::MainWindow( QWidget* parent, const char* name, WFlags /*fl*/ ) 47MainWindow::MainWindow( QWidget* parent, const char* name, WFlags /*fl*/ )
48 : QMainWindow( parent, name, WStyle_ContextHelp ) 48 : QMainWindow( parent, name, WStyle_ContextHelp )
49{ 49{
50 setCaption( tr( "Checkbook" ) ); 50 setCaption( tr( "Checkbook" ) );
51 51
52 cbDir = Global::applicationFileName( "checkbook", "" ); 52 cbDir = Global::applicationFileName( "checkbook", "" );
53 lockIcon = Resource::loadPixmap( "locked" ); 53 lockIcon = Resource::loadPixmap( "locked" );
54 54
55 // Load configuration options 55 // Load configuration options
56 Config config( "checkbook" ); 56 Config config( "checkbook" );
57 _cfg.readConfig( config ); 57 _cfg.readConfig( config );
58 58
59 59
60 // Build menu and tool bars 60 // Build menu and tool bars
61 setToolBarsMovable( FALSE ); 61 setToolBarsMovable( FALSE );
62 62
63 QToolBar *bar = new QToolBar( this ); 63 QToolBar *bar = new QToolBar( this );
64 bar->setHorizontalStretchable( TRUE ); 64 bar->setHorizontalStretchable( TRUE );
65 QMenuBar *mb = new QMenuBar( bar ); 65 QMenuBar *mb = new QMenuBar( bar );
66 mb->setMargin( 0 ); 66 mb->setMargin( 0 );
67 QPopupMenu *popup = new QPopupMenu( this ); 67 QPopupMenu *popup = new QPopupMenu( this );
68 68
69 bar = new QToolBar( this ); 69 bar = new QToolBar( this );
70 QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); 70 QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 );
71 a->setWhatsThis( tr( "Click here to create a new checkbook.\n\nYou also can select New from the Checkbook menu." ) ); 71 a->setWhatsThis( tr( "Click here to create a new checkbook.\n\nYou also can select New from the Checkbook menu." ) );
72 connect( a, SIGNAL( activated() ), this, SLOT( slotNew() ) ); 72 connect( a, SIGNAL( activated() ), this, SLOT( slotNew() ) );
73 a->addTo( popup ); 73 a->addTo( popup );
74 a->addTo( bar ); 74 a->addTo( bar );
75 75
76 actionOpen = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ), QString::null, 76 actionOpen = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ), QString::null,
77 0, this, 0 ); 77 0, this, 0 );
78 actionOpen->setWhatsThis( tr( "Select a checkbook and then click here to edit it.\n\nYou also can select Edit from the Checkbook menu, or click and hold on a checkbook name." ) ); 78 actionOpen->setWhatsThis( tr( "Select a checkbook and then click here to edit it.\n\nYou also can select Edit from the Checkbook menu, or click and hold on a checkbook name." ) );
79 connect( actionOpen, SIGNAL( activated() ), this, SLOT( slotEdit() ) ); 79 connect( actionOpen, SIGNAL( activated() ), this, SLOT( slotEdit() ) );
80 actionOpen->addTo( popup ); 80 actionOpen->addTo( popup );
81 actionOpen->addTo( bar ); 81 actionOpen->addTo( bar );
82 82
83 actionDelete = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, 83 actionDelete = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null,
84 0, this, 0 ); 84 0, this, 0 );
85 actionDelete->setWhatsThis( tr( "Select a checkbook and then click here delete it.\n\nYou also can select Delete from the Checkbook menu." ) ); 85 actionDelete->setWhatsThis( tr( "Select a checkbook and then click here delete it.\n\nYou also can select Delete from the Checkbook menu." ) );
86 connect( actionDelete, SIGNAL( activated() ), this, SLOT( slotDelete() ) ); 86 connect( actionDelete, SIGNAL( activated() ), this, SLOT( slotDelete() ) );
87 actionDelete->addTo( popup ); 87 actionDelete->addTo( popup );
88 actionDelete->addTo( bar ); 88 actionDelete->addTo( bar );
89 89
90 popup->insertSeparator(); 90 popup->insertSeparator();
91 91
92 a = new QAction( tr( "Configure" ), Resource::loadPixmap( "SettingsIcon" ), QString::null, 0, this, 0 ); 92 a = new QAction( tr( "Configure" ), Resource::loadPixmap( "SettingsIcon" ), QString::null, 0, this, 0 );
93 a->setWhatsThis( tr( "Click here to configure this app." ) ); 93 a->setWhatsThis( tr( "Click here to configure this app." ) );
94 connect( a, SIGNAL( activated() ), this, SLOT( slotConfigure() ) ); 94 connect( a, SIGNAL( activated() ), this, SLOT( slotConfigure() ) );
95 a->addTo( popup ); 95 a->addTo( popup );
96 a->addTo( bar ); 96 a->addTo( bar );
97 97
98 mb->insertItem( tr( "Checkbook" ), popup ); 98 mb->insertItem( tr( "Checkbook" ), popup );
99 99
100 // Load Checkbook selection list 100 // Load Checkbook selection list
101 checkbooks = new CBInfoList(); 101 checkbooks = new CBInfoList();
102 102
103 QDir checkdir( cbDir ); 103 QDir checkdir( cbDir );
104 if (checkdir.exists() == true) 104 if (checkdir.exists() == true)
105 { 105 {
106 QStringList cblist = checkdir.entryList( "*.qcb", QDir::Files|QDir::Readable|QDir::Writable, 106 QStringList cblist = checkdir.entryList( "*.qcb", QDir::Files|QDir::Readable|QDir::Writable,
107 QDir::Time ); 107 QDir::Time );
108 CBInfo *cb = 0x0; 108 CBInfo *cb = 0x0;
109 QString filename; 109 QString filename;
110 110
111 for ( QStringList::Iterator it = cblist.begin(); it != cblist.end(); it++ ) 111 for ( QStringList::Iterator it = cblist.begin(); it != cblist.end(); it++ )
112 { 112 {
113 filename = cbDir; 113 filename = cbDir;
114 filename.append( (*it) ); 114 filename.append( (*it) );
115 115
116 cb = new CBInfo( (*it).remove( (*it).find('.'), (*it).length() ), filename ); 116 cb = new CBInfo( (*it).remove( (*it).find('.'), (*it).length() ), filename );
117 checkbooks->inSort( cb ); 117 checkbooks->inSort( cb );
118 } 118 }
119 } 119 }
120 120
121 // Build Checkbook selection list control 121 // Build Checkbook selection list control
122 cbList = 0x0; 122 cbList = 0x0;
123 buildList(); 123 buildList();
124 124
125 // open last book? 125 // open last book?
126 if( _cfg.isOpenLastBook() ) { 126 if( _cfg.isOpenLastBook() ) {
127 this->show(); 127 this->show();
128 this->showMaximized(); 128 this->showMaximized();
129 QListViewItem *itm=cbList->firstChild(); 129 QListViewItem *itm=cbList->firstChild();
130 while( itm ) { 130 while( itm ) {
131 if( itm->text(posName)==_cfg.getLastBook() ) { 131 if( itm->text(posName)==_cfg.getLastBook() ) {
132 openBook( itm ); 132 openBook( itm );
133 break; 133 break;
134 } 134 }
135 itm=itm->nextSibling(); 135 itm=itm->nextSibling();
136 } 136 }
137 } 137 }
138} 138}
139 139
140 140
141// --- ~MainWindow ------------------------------------------------------------ 141// --- ~MainWindow ------------------------------------------------------------
142MainWindow::~MainWindow() 142MainWindow::~MainWindow()
143{ 143{
144 writeConfig(); 144 writeConfig();
145} 145}
146 146
147 147
148// --- buildList -------------------------------------------------------------- 148// --- buildList --------------------------------------------------------------
149void MainWindow::buildList() 149void MainWindow::buildList()
150{ 150{
151 if ( cbList ) 151 if ( cbList )
152 delete cbList; 152 delete cbList;
153 153
154 cbList = new QListView( this ); 154 cbList = new QListView( this );
155 QWhatsThis::add( cbList, tr( "This is a listing of all checkbooks currently available." ) ); 155 QWhatsThis::add( cbList, tr( "This is a listing of all checkbooks currently available." ) );
156 156
157 if ( _cfg.getShowLocks() ) 157 if ( _cfg.getShowLocks() )
158 { 158 {
159 cbList->addColumn( Resource::loadIconSet( "locked" ), "", 24 ); 159 cbList->addColumn( Resource::loadIconSet( "locked" ), "", 24 );
160 posName = 1; 160 posName = 1;
161 } 161 }
162 else 162 else
163 { 163 {
164 posName = 0; 164 posName = 0;
165 } 165 }
166 cbList->addColumn( tr( "Checkbook Name" ) ); 166 cbList->addColumn( tr( "Checkbook Name" ) );
167 if ( _cfg.getShowBalances() ) 167 if ( _cfg.getShowBalances() )
168 { 168 {
169 int colnum = cbList->addColumn( tr( "Balance" ) ); 169 int colnum = cbList->addColumn( tr( "Balance" ) );
170 cbList->setColumnAlignment( colnum, Qt::AlignRight ); 170 cbList->setColumnAlignment( colnum, Qt::AlignRight );
171 } 171 }
172 cbList->setAllColumnsShowFocus( TRUE ); 172 cbList->setAllColumnsShowFocus( TRUE );
173 cbList->setSorting( posName ); 173 cbList->setSorting( posName );
174 QPEApplication::setStylusOperation( cbList->viewport(), QPEApplication::RightOnHold ); 174 QPEApplication::setStylusOperation( cbList->viewport(), QPEApplication::RightOnHold );
175 connect( cbList, SIGNAL( rightButtonPressed(QListViewItem*,const QPoint&,int) ), 175 connect( cbList, SIGNAL( rightButtonPressed(QListViewItem*,const QPoint&,int) ),
176 this, SLOT( slotEdit() ) ); 176 this, SLOT( slotEdit() ) );
177 setCentralWidget( cbList ); 177 setCentralWidget( cbList );
178 178
179 for ( CBInfo *cb = checkbooks->first(); cb; cb = checkbooks->next() ) 179 for ( CBInfo *cb = checkbooks->first(); cb; cb = checkbooks->next() )
180 { 180 {
181 addCheckbook( cb ); 181 addCheckbook( cb );
182 } 182 }
183} 183}
184 184
185void MainWindow::addCheckbook( CBInfo *cb ) 185void MainWindow::addCheckbook( CBInfo *cb )
186{ 186{
187 QListViewItem *lvi = new QListViewItem( cbList ); 187 QListViewItem *lvi = new QListViewItem( cbList );
188 if ( _cfg.getShowLocks() && !cb->password().isNull() ) 188 if ( _cfg.getShowLocks() && !cb->password().isNull() )
189 { 189 {
190 lvi->setPixmap( 0, lockIcon ); 190 lvi->setPixmap( 0, lockIcon );
191 } 191 }
192 lvi->setText( posName, cb->name() ); 192 lvi->setText( posName, cb->name() );
193 if ( _cfg.getShowBalances() ) 193 if ( _cfg.getShowBalances() )
194 { 194 {
195 QString balance; 195 QString balance;
196 balance.sprintf( "%s%.2f", _cfg.getCurrencySymbol().latin1(), cb->balance() ); 196 balance.sprintf( "%s%.2f", _cfg.getCurrencySymbol().latin1(), cb->balance() );
197 lvi->setText( posName + 1, balance ); 197 lvi->setText( posName + 1, balance );
198 } 198 }
199} 199}
200 200
201void MainWindow::buildFilename( const QString &name ) 201void MainWindow::buildFilename( const QString &name )
202{ 202{
203 tempFilename = cbDir; 203 tempFilename = cbDir;
204 tempFilename.append( name ); 204 tempFilename.append( name );
205 tempFilename.append( ".qcb" ); 205 tempFilename.append( ".qcb" );
206} 206}
207 207
208void MainWindow::slotNew() 208void MainWindow::slotNew()
209{ 209{
210 CBInfo *cb = new CBInfo(); 210 CBInfo *cb = new CBInfo();
211 211
212 Checkbook *currcb = new Checkbook( this, cb, &_cfg ); 212 Checkbook *currcb = new Checkbook( this, cb, &_cfg );
213 if ( QPEApplication::execDialog( currcb ) == QDialog::Accepted ) 213 if ( QPEApplication::execDialog( currcb ) == QDialog::Accepted )
214 { 214 {
215 // Save new checkbook 215 // Save new checkbook
216 buildFilename( cb->name() ); 216 buildFilename( cb->name() );
217 _cfg.setLastBook( cb->name() ); 217 _cfg.setLastBook( cb->name() );
218 cb->setFilename( tempFilename ); 218 cb->setFilename( tempFilename );
219 cb->write(); 219 cb->write();
220 220
221 // Add to listbox 221 // Add to listbox
222 checkbooks->inSort( cb ); 222 checkbooks->inSort( cb );
223 addCheckbook( cb ); 223 addCheckbook( cb );
224 } 224 }
225 delete currcb; 225 delete currcb;
226} 226}
227 227
228// --- slotEdit --------------------------------------------------------------- 228// --- slotEdit ---------------------------------------------------------------
229void MainWindow::slotEdit() 229void MainWindow::slotEdit()
230{ 230{
diff --git a/noncore/apps/confedit/main.cpp b/noncore/apps/confedit/main.cpp
index 584e6b2..3a010dd 100644
--- a/noncore/apps/confedit/main.cpp
+++ b/noncore/apps/confedit/main.cpp
@@ -1,5 +1,6 @@
1
2#include "mainwindow.h" 1#include "mainwindow.h"
3#include <opie2/oapplicationfactory.h> 2#include <opie2/oapplicationfactory.h>
4 3
4using namespace Opie::Core;
5
5OPIE_EXPORT_APP( OApplicationFactory<MainWindow> ) 6OPIE_EXPORT_APP( OApplicationFactory<MainWindow> )
diff --git a/noncore/apps/odict/main.cpp b/noncore/apps/odict/main.cpp
index d5b08d3..7729d5f 100644
--- a/noncore/apps/odict/main.cpp
+++ b/noncore/apps/odict/main.cpp
@@ -1,24 +1,26 @@
1/*************************************************************************** 1/***************************************************************************
2 application: : ODict 2 application: : ODict
3 3
4 begin : December 2002 4 begin : December 2002
5 copyright : ( C ) 2002, 2003 by Carsten Niehaus 5 copyright : ( C ) 2002, 2003 by Carsten Niehaus
6 email : cniehaus@handhelds.org 6 email : cniehaus@handhelds.org
7 **************************************************************************/ 7 **************************************************************************/
8 8
9/*************************************************************************** 9/***************************************************************************
10 * * 10 * *
11 * This program is free software; you can redistribute it and/or modify * 11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by * 12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or * 13 * the Free Software Foundation; either version 2 of the License, or *
14 * ( at your option ) any later version. * 14 * ( at your option ) any later version. *
15 * * 15 * *
16 **************************************************************************/ 16 **************************************************************************/
17 17
18 18
19#include <opie2/oapplicationfactory.h> 19#include <opie2/oapplicationfactory.h>
20 20
21#include "odict.h" 21#include "odict.h"
22 22
23 23
24using namespace Opie::Core;
25using namespace Opie::Core;
24OPIE_EXPORT_APP( OApplicationFactory<ODict> ) 26OPIE_EXPORT_APP( OApplicationFactory<ODict> )
diff --git a/noncore/apps/odict/searchmethoddlg.cpp b/noncore/apps/odict/searchmethoddlg.cpp
index f71cfd8..34e8b16 100644
--- a/noncore/apps/odict/searchmethoddlg.cpp
+++ b/noncore/apps/odict/searchmethoddlg.cpp
@@ -1,109 +1,108 @@
1/*************************************************************************** 1/***************************************************************************
2 application: : ODict 2 application: : ODict
3 3
4 begin : December 2002 4 begin : December 2002
5 copyright : ( C ) 2002, 2003 by Carsten Niehaus 5 copyright : ( C ) 2002, 2003 by Carsten Niehaus
6 email : cniehaus@handhelds.org 6 email : cniehaus@handhelds.org
7 **************************************************************************/ 7 **************************************************************************/
8 8
9/*************************************************************************** 9/***************************************************************************
10 * * 10 * *
11 * This program is free software; you can redistribute it and/or modify * 11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by * 12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or * 13 * the Free Software Foundation; either version 2 of the License, or *
14 * ( at your option ) any later version. * 14 * ( at your option ) any later version. *
15 * * 15 * *
16 **************************************************************************/ 16 **************************************************************************/
17#include "searchmethoddlg.h" 17#include "searchmethoddlg.h"
18 18
19#include <opie2/ofileselector.h> 19#include <opie2/ofileselector.h>
20#include <opie2/ofiledialog.h> 20#include <opie2/ofiledialog.h>
21 21
22#include <qpe/config.h> 22#include <qpe/config.h>
23#include <qpe/qpeapplication.h> 23#include <qpe/qpeapplication.h>
24 24
25#include <qlayout.h> 25#include <qlayout.h>
26#include <qvbox.h> 26#include <qvbox.h>
27#include <qlabel.h> 27#include <qlabel.h>
28#include <qpushbutton.h> 28#include <qpushbutton.h>
29#include <qlineedit.h> 29#include <qlineedit.h>
30#include <qdir.h> 30#include <qdir.h>
31 31
32using Opie::OFileDialog; 32using namespace Opie::Ui;
33using Opie::OFileSelector;
34 33
35SearchMethodDlg::SearchMethodDlg(QWidget *parent, const char *name, bool modal, QString itemname) : QDialog(parent, name, modal) 34SearchMethodDlg::SearchMethodDlg(QWidget *parent, const char *name, bool modal, QString itemname) : QDialog(parent, name, modal)
36{ 35{
37 36
38 QVBoxLayout *vbox_layout = new QVBoxLayout( this, 4,4,"vbox_layout" ); 37 QVBoxLayout *vbox_layout = new QVBoxLayout( this, 4,4,"vbox_layout" );
39 QVBox *vbox = new QVBox( this ); 38 QVBox *vbox = new QVBox( this );
40 39
41 QHBox *hbox1 = new QHBox( vbox ); 40 QHBox *hbox1 = new QHBox( vbox );
42 QLabel *nameLabel = new QLabel( tr( "Name:" ) , hbox1 ); 41 QLabel *nameLabel = new QLabel( tr( "Name:" ) , hbox1 );
43 nameLE = new QLineEdit( hbox1 ); 42 nameLE = new QLineEdit( hbox1 );
44 43
45 QLabel *dictLabel = new QLabel( tr( "Dictionary file" ), vbox ); 44 QLabel *dictLabel = new QLabel( tr( "Dictionary file" ), vbox );
46 QHBox *hbox2 = new QHBox( vbox ); 45 QHBox *hbox2 = new QHBox( vbox );
47 dictFileLE = new QLineEdit( hbox2 ); 46 dictFileLE = new QLineEdit( hbox2 );
48 QPushButton *browseButton = new QPushButton( tr( "Browse" ) , hbox2 ); 47 QPushButton *browseButton = new QPushButton( tr( "Browse" ) , hbox2 );
49 connect( browseButton, SIGNAL( clicked() ), this, SLOT( slotBrowse() ) ); 48 connect( browseButton, SIGNAL( clicked() ), this, SLOT( slotBrowse() ) );
50 49
51 QWidget *dummywidget = new QWidget( vbox ); 50 QWidget *dummywidget = new QWidget( vbox );
52 QLabel *lag1 = new QLabel( tr( "Language 1" ),dummywidget); 51 QLabel *lag1 = new QLabel( tr( "Language 1" ),dummywidget);
53 QLabel *devider = new QLabel( tr( "Decollator" ),dummywidget); 52 QLabel *devider = new QLabel( tr( "Decollator" ),dummywidget);
54 QLabel *lag2 = new QLabel( tr( "Language 2" ),dummywidget); 53 QLabel *lag2 = new QLabel( tr( "Language 2" ),dummywidget);
55 lang1 = new QLineEdit( dummywidget ); 54 lang1 = new QLineEdit( dummywidget );
56 lang2 = new QLineEdit( dummywidget ); 55 lang2 = new QLineEdit( dummywidget );
57 trenner = new QLineEdit( dummywidget ); 56 trenner = new QLineEdit( dummywidget );
58 trenner->setText( "::" ); 57 trenner->setText( "::" );
59 58
60 QGridLayout *grid = new QGridLayout( dummywidget, 2,3 ); 59 QGridLayout *grid = new QGridLayout( dummywidget, 2,3 );
61 grid->addWidget( lag1, 0,0 ); 60 grid->addWidget( lag1, 0,0 );
62 grid->addWidget( devider, 0,1 ); 61 grid->addWidget( devider, 0,1 );
63 grid->addWidget( lag2, 0,2 ); 62 grid->addWidget( lag2, 0,2 );
64 grid->addWidget( lang1, 1,0 ); 63 grid->addWidget( lang1, 1,0 );
65 grid->addWidget( trenner, 1,1 ); 64 grid->addWidget( trenner, 1,1 );
66 grid->addWidget( lang2, 1,2 ); 65 grid->addWidget( lang2, 1,2 );
67 66
68 vbox_layout->addWidget( vbox ); 67 vbox_layout->addWidget( vbox );
69 68
70 QPEApplication::execDialog ( this ); 69 QPEApplication::execDialog ( this );
71 70
72 if( !itemname ) 71 if( !itemname )
73 setCaption( tr( "New Searchmethod" ) ); 72 setCaption( tr( "New Searchmethod" ) );
74 else 73 else
75 { 74 {
76 setCaption( tr( "Change Searchmethod" ) ); 75 setCaption( tr( "Change Searchmethod" ) );
77 itemName = itemname; 76 itemName = itemname;
78 setupEntries(itemname); 77 setupEntries(itemname);
79 } 78 }
80} 79}
81 80
82void SearchMethodDlg::setupEntries( QString item ) 81void SearchMethodDlg::setupEntries( QString item )
83{ 82{
84 Config cfg( "odict" ); 83 Config cfg( "odict" );
85 cfg.setGroup( "Method_"+itemName ); 84 cfg.setGroup( "Method_"+itemName );
86 trenner->setText( cfg.readEntry( "Seperator" ) ); 85 trenner->setText( cfg.readEntry( "Seperator" ) );
87 lang1->setText( cfg.readEntry( "Lang1" ) ); 86 lang1->setText( cfg.readEntry( "Lang1" ) );
88 lang2->setText( cfg.readEntry( "Lang2" ) ); 87 lang2->setText( cfg.readEntry( "Lang2" ) );
89 nameLE->setText( itemName ); 88 nameLE->setText( itemName );
90 dictFileLE->setText( cfg.readEntry( "file" ) ); 89 dictFileLE->setText( cfg.readEntry( "file" ) );
91} 90}
92 91
93void SearchMethodDlg::slotBrowse() 92void SearchMethodDlg::slotBrowse()
94{ 93{
95 itemName=OFileDialog::getOpenFileName( OFileSelector::EXTENDED,QDir::homeDirPath()); 94 itemName=OFileDialog::getOpenFileName( OFileSelector::EXTENDED,QDir::homeDirPath());
96 dictFileLE->setText( itemName ); 95 dictFileLE->setText( itemName );
97} 96}
98 97
99void SearchMethodDlg::saveItem() 98void SearchMethodDlg::saveItem()
100{ 99{
101 QString name = nameLE->text(); 100 QString name = nameLE->text();
102 Config cfg( "odict" ); 101 Config cfg( "odict" );
103 cfg.setGroup( "Method_"+name ); 102 cfg.setGroup( "Method_"+name );
104 cfg.writeEntry( "Name", name ); 103 cfg.writeEntry( "Name", name );
105 cfg.writeEntry( "Seperator", trenner->text() ); 104 cfg.writeEntry( "Seperator", trenner->text() );
106 cfg.writeEntry( "Lang1", lang1->text() ); 105 cfg.writeEntry( "Lang1", lang1->text() );
107 cfg.writeEntry( "Lang2", lang2->text() ); 106 cfg.writeEntry( "Lang2", lang2->text() );
108 cfg.writeEntry( "file", dictFileLE->text() ); 107 cfg.writeEntry( "file", dictFileLE->text() );
109} 108}
diff --git a/noncore/apps/opie-bartender/bartender.cpp b/noncore/apps/opie-bartender/bartender.cpp
index b6401ed..e6cb515 100644
--- a/noncore/apps/opie-bartender/bartender.cpp
+++ b/noncore/apps/opie-bartender/bartender.cpp
@@ -1,211 +1,211 @@
1/**************************************************************************** 1/****************************************************************************
2** 2**
3** Created: Sat Jul 20 08:10:53 2002 3** Created: Sat Jul 20 08:10:53 2002
4** by: L.J. Potter <ljp@llornkcor.com> 4** by: L.J. Potter <ljp@llornkcor.com>
5** copyright : (C) 2002 by ljp 5** copyright : (C) 2002 by ljp
6 email : ljp@llornkcor.com 6 email : ljp@llornkcor.com
7 * This program is free software; you can redistribute it and/or modify * 7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by * 8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or * 9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. * 10 * (at your option) any later version. *
11 ***************************************************************************/ 11 ***************************************************************************/
12 12
13#include "bartender.h" 13#include "bartender.h"
14#include "showdrinks.h" 14#include "showdrinks.h"
15#include "inputDialog.h" 15#include "inputDialog.h"
16#include "searchresults.h" 16#include "searchresults.h"
17#include "bac.h" 17#include "bac.h"
18 18
19#include <qpe/qpetoolbar.h> 19#include <qtoolbar.h>
20#include <qmenubar.h> 20#include <qmenubar.h>
21//#include <opie2/colorpopupmenu.h> 21//#include <opie2/colorpopupmenu.h>
22#include <qpe/qpeapplication.h> 22#include <qpe/qpeapplication.h>
23#include <qpe/resource.h> 23#include <qpe/resource.h>
24 24
25#include <qlineedit.h> 25#include <qlineedit.h>
26#include <qdir.h> 26#include <qdir.h>
27#include <qpushbutton.h> 27#include <qpushbutton.h>
28#include <qlistbox.h> 28#include <qlistbox.h>
29#include <qmultilineedit.h> 29#include <qmultilineedit.h>
30#include <qmessagebox.h> 30#include <qmessagebox.h>
31#include <qtextstream.h> 31#include <qtextstream.h>
32#include <qaction.h> 32#include <qaction.h>
33#include <qheader.h> 33#include <qheader.h>
34#include <qlistview.h> 34#include <qlistview.h>
35#include <qlayout.h> 35#include <qlayout.h>
36 36
37#include <fcntl.h> 37#include <fcntl.h>
38#include <unistd.h> 38#include <unistd.h>
39#include <stdlib.h> 39#include <stdlib.h>
40#include <stdio.h> 40#include <stdio.h>
41#include <errno.h> 41#include <errno.h>
42 42
43 43
44Bartender::Bartender( QWidget* parent, const char* name, WFlags fl ) 44Bartender::Bartender( QWidget* parent, const char* name, WFlags fl )
45 : QMainWindow( parent, name, fl ) { 45 : QMainWindow( parent, name, fl ) {
46 if ( !name ) 46 if ( !name )
47 setName( "Bartender" ); 47 setName( "Bartender" );
48 QGridLayout *layout = new QGridLayout( this ); 48 QGridLayout *layout = new QGridLayout( this );
49 layout->setSpacing( 2); 49 layout->setSpacing( 2);
50 layout->setMargin( 2); 50 layout->setMargin( 2);
51 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); 51 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
52 52
53 setCaption( tr( "Bartender" ) ); 53 setCaption( tr( "Bartender" ) );
54 54
55 ToolBar1 = new QToolBar( this, "ToolBar1" ); 55 ToolBar1 = new QToolBar( this, "ToolBar1" );
56 ToolBar1->setFixedHeight(22); 56 ToolBar1->setFixedHeight(22);
57 layout->addMultiCellWidget( ToolBar1, 0, 0, 0, 4 ); 57 layout->addMultiCellWidget( ToolBar1, 0, 0, 0, 4 );
58 58
59 QMenuBar *menuBar = new QMenuBar( ToolBar1 ); 59 QMenuBar *menuBar = new QMenuBar( ToolBar1 );
60 QPopupMenu *fileMenu; 60 QPopupMenu *fileMenu;
61 fileMenu = new QPopupMenu( this); 61 fileMenu = new QPopupMenu( this);
62 menuBar->insertItem( tr("File"), fileMenu ); 62 menuBar->insertItem( tr("File"), fileMenu );
63 63
64 fileMenu->insertItem(tr("New Drink")); 64 fileMenu->insertItem(tr("New Drink"));
65 fileMenu->insertItem(tr("Open Drink")); 65 fileMenu->insertItem(tr("Open Drink"));
66 fileMenu->insertItem(tr("Find by Drink Name")); 66 fileMenu->insertItem(tr("Find by Drink Name"));
67 fileMenu->insertItem(tr("Find by Alcohol")); 67 fileMenu->insertItem(tr("Find by Alcohol"));
68 68
69 QPopupMenu *editMenu; 69 QPopupMenu *editMenu;
70 editMenu = new QPopupMenu( this); 70 editMenu = new QPopupMenu( this);
71 menuBar->insertItem( tr("Edit"), editMenu ); 71 menuBar->insertItem( tr("Edit"), editMenu );
72 editMenu->insertItem(tr("edit")); 72 editMenu->insertItem(tr("edit"));
73 73
74 connect( fileMenu, SIGNAL( activated(int) ), this, SLOT( fileMenuActivated(int) )); 74 connect( fileMenu, SIGNAL( activated(int) ), this, SLOT( fileMenuActivated(int) ));
75 connect( editMenu, SIGNAL( activated(int) ), this, SLOT( editMenuActivated(int) )); 75 connect( editMenu, SIGNAL( activated(int) ), this, SLOT( editMenuActivated(int) ));
76 76
77 77
78 QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), "New", 0, this, 0 ); 78 QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), "New", 0, this, 0 );
79 connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) ); 79 connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) );
80 a->addTo( ToolBar1 ); 80 a->addTo( ToolBar1 );
81 81
82 a = new QAction( tr( "Open" ), Resource::loadPixmap( "bartender/bartender_sm" ), "open", 0, this, 0 ); 82 a = new QAction( tr( "Open" ), Resource::loadPixmap( "bartender/bartender_sm" ), "open", 0, this, 0 );
83 connect( a, SIGNAL( activated() ), this, SLOT( openCurrentDrink() ) ); 83 connect( a, SIGNAL( activated() ), this, SLOT( openCurrentDrink() ) );
84 a->addTo( ToolBar1 ); 84 a->addTo( ToolBar1 );
85 85
86 a = new QAction( tr( "Find" ), Resource::loadPixmap( "find" ), "Find", 0, this, 0 ); 86 a = new QAction( tr( "Find" ), Resource::loadPixmap( "find" ), "Find", 0, this, 0 );
87 connect( a, SIGNAL( activated() ), this, SLOT( askSearch() ) ); 87 connect( a, SIGNAL( activated() ), this, SLOT( askSearch() ) );
88 a->addTo( ToolBar1 ); 88 a->addTo( ToolBar1 );
89 89
90 a = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ),"Edit", 0, this, 0 ); 90 a = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ),"Edit", 0, this, 0 );
91 connect( a, SIGNAL( activated() ), this, SLOT( doEdit() ) ); 91 connect( a, SIGNAL( activated() ), this, SLOT( doEdit() ) );
92 a->addTo( ToolBar1 ); 92 a->addTo( ToolBar1 );
93 93
94 QPushButton *t; 94 QPushButton *t;
95 t= new QPushButton( "BAC", ToolBar1, "bacButtin"); 95 t= new QPushButton( "BAC", ToolBar1, "bacButtin");
96 connect( t, SIGNAL( clicked() ), this, SLOT( doBac() ) ); 96 connect( t, SIGNAL( clicked() ), this, SLOT( doBac() ) );
97 97
98 DrinkView = new QListView( this, "DrinkView" ); 98 DrinkView = new QListView( this, "DrinkView" );
99 DrinkView->addColumn( tr( "Name of Drink" ) ); 99 DrinkView->addColumn( tr( "Name of Drink" ) );
100// DrinkView->setRootIsDecorated( TRUE ); 100// DrinkView->setRootIsDecorated( TRUE );
101 DrinkView->header()->hide(); 101 DrinkView->header()->hide();
102 102
103 QPEApplication::setStylusOperation( DrinkView->viewport(),QPEApplication::RightOnHold); 103 QPEApplication::setStylusOperation( DrinkView->viewport(),QPEApplication::RightOnHold);
104 104
105 connect(DrinkView, SIGNAL( doubleClicked(QListViewItem*)),this,SLOT(showDrink(QListViewItem*))); 105 connect(DrinkView, SIGNAL( doubleClicked(QListViewItem*)),this,SLOT(showDrink(QListViewItem*)));
106 connect(DrinkView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)), 106 connect(DrinkView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)),
107 this,SLOT( showDrink(int,QListViewItem*,const QPoint&,int))); 107 this,SLOT( showDrink(int,QListViewItem*,const QPoint&,int)));
108 108
109 layout->addMultiCellWidget( DrinkView, 1, 2, 0, 4 ); 109 layout->addMultiCellWidget( DrinkView, 1, 2, 0, 4 );
110 if(QDir("db").exists()) { 110 if(QDir("db").exists()) {
111 dbFile.setName( "db/drinkdb.txt"); 111 dbFile.setName( "db/drinkdb.txt");
112 } else 112 } else
113 dbFile.setName( QPEApplication::qpeDir()+"/etc/bartender/drinkdb.txt"); 113 dbFile.setName( QPEApplication::qpeDir()+"/etc/bartender/drinkdb.txt");
114 initDrinkDb(); 114 initDrinkDb();
115} 115}
116 116
117Bartender::~Bartender() { 117Bartender::~Bartender() {
118} 118}
119 119
120/* 120/*
121this happens right before exit */ 121this happens right before exit */
122void Bartender::cleanUp() { 122void Bartender::cleanUp() {
123 dbFile.close(); 123 dbFile.close();
124 124
125} 125}
126 126
127void Bartender::initDrinkDb() { 127void Bartender::initDrinkDb() {
128 128
129 if(!dbFile.isOpen()) 129 if(!dbFile.isOpen())
130 if ( !dbFile.open( IO_ReadOnly)) { 130 if ( !dbFile.open( IO_ReadOnly)) {
131 QMessageBox::message( (tr("Note")), (tr("Drink database not opened sucessfully.\n")) ); 131 QMessageBox::message( (tr("Note")), (tr("Drink database not opened sucessfully.\n")) );
132 return; 132 return;
133 } 133 }
134 fillList(); 134 fillList();
135} 135}
136 136
137void Bartender::fillList() { 137void Bartender::fillList() {
138 dbFile.at(1); 138 dbFile.at(1);
139 DrinkView->clear(); 139 DrinkView->clear();
140 int i=0; 140 int i=0;
141 QListViewItem * item ; 141 QListViewItem * item ;
142 QTextStream t( &dbFile); 142 QTextStream t( &dbFile);
143 QString s; 143 QString s;
144 while ( !t.eof()) { 144 while ( !t.eof()) {
145 s = t.readLine(); 145 s = t.readLine();
146 if(s.find("#",0,TRUE) != -1) { 146 if(s.find("#",0,TRUE) != -1) {
147// qDebug(s.right(s.length()-2)); 147// qDebug(s.right(s.length()-2));
148 item= new QListViewItem( DrinkView, 0 ); 148 item= new QListViewItem( DrinkView, 0 );
149 item->setText( 0, s.right(s.length()-2)); 149 item->setText( 0, s.right(s.length()-2));
150 i++; 150 i++;
151 } 151 }
152 } 152 }
153 qDebug("there are currently %d of drinks", i); 153 qDebug("there are currently %d of drinks", i);
154} 154}
155 155
156void Bartender::fileNew() { 156void Bartender::fileNew() {
157 157
158 New_Drink *newDrinks; 158 New_Drink *newDrinks;
159 newDrinks = new New_Drink(this,"New Drink....", TRUE); 159 newDrinks = new New_Drink(this,"New Drink....", TRUE);
160 QString newName, newIng; 160 QString newName, newIng;
161 QPEApplication::execDialog( newDrinks ); 161 QPEApplication::execDialog( newDrinks );
162 newName = newDrinks->LineEdit1->text(); 162 newName = newDrinks->LineEdit1->text();
163 newIng= newDrinks->MultiLineEdit1->text(); 163 newIng= newDrinks->MultiLineEdit1->text();
164 164
165 if(dbFile.isOpen()) 165 if(dbFile.isOpen())
166 dbFile.close(); 166 dbFile.close();
167 if ( !dbFile.open( IO_WriteOnly| IO_Append)) { 167 if ( !dbFile.open( IO_WriteOnly| IO_Append)) {
168 QMessageBox::message( (tr("Note")), (tr("Drink database not opened sucessfully.\n")) ); 168 QMessageBox::message( (tr("Note")), (tr("Drink database not opened sucessfully.\n")) );
169 return; 169 return;
170 } 170 }
171 if(newDrinks ->result() == 1 ) { 171 if(newDrinks ->result() == 1 ) {
172 QString newDrink="\n# "+newName+"\n"; 172 QString newDrink="\n# "+newName+"\n";
173 newDrink.append(newIng+"\n"); 173 newDrink.append(newIng+"\n");
174 qDebug("writing "+newDrink); 174 qDebug("writing "+newDrink);
175 dbFile.writeBlock( newDrink.latin1(), newDrink.length()); 175 dbFile.writeBlock( newDrink.latin1(), newDrink.length());
176 clearList(); 176 clearList();
177 dbFile.close(); 177 dbFile.close();
178 178
179 initDrinkDb(); 179 initDrinkDb();
180 } 180 }
181 delete newDrinks; 181 delete newDrinks;
182} 182}
183 183
184void Bartender::showDrink(int mouse, QListViewItem * item, const QPoint&, int) { 184void Bartender::showDrink(int mouse, QListViewItem * item, const QPoint&, int) {
185 switch (mouse) { 185 switch (mouse) {
186 case 1: 186 case 1:
187// showDrink(item); 187// showDrink(item);
188 break; 188 break;
189 case 2: 189 case 2:
190 showDrink(item); 190 showDrink(item);
191 break; 191 break;
192 } 192 }
193} 193}
194 194
195void Bartender::showDrink( QListViewItem *item) { 195void Bartender::showDrink( QListViewItem *item) {
196 if(item==NULL) return; 196 if(item==NULL) return;
197 dbFile.at(0); 197 dbFile.at(0);
198 Show_Drink *showDrinks; 198 Show_Drink *showDrinks;
199 QString myDrink=item->text(0); 199 QString myDrink=item->text(0);
200 showDrinks = new Show_Drink(this, myDrink, TRUE); 200 showDrinks = new Show_Drink(this, myDrink, TRUE);
201 QTextStream t( &dbFile); 201 QTextStream t( &dbFile);
202 202
203 QString s, s2; 203 QString s, s2;
204 while ( !t.eof()) { 204 while ( !t.eof()) {
205 s = t.readLine(); 205 s = t.readLine();
206 if(s.find( myDrink, 0, TRUE) != -1) { 206 if(s.find( myDrink, 0, TRUE) != -1) {
207 for(int i=0;s2.find( "#", 0, TRUE) == -1;i++) { 207 for(int i=0;s2.find( "#", 0, TRUE) == -1;i++) {
208 s2 = t.readLine(); 208 s2 = t.readLine();
209 if(s2.find("#",0,TRUE) == -1 || dbFile.atEnd() ) { 209 if(s2.find("#",0,TRUE) == -1 || dbFile.atEnd() ) {
210// qDebug(s2); 210// qDebug(s2);
211 showDrinks->MultiLineEdit1->append(s2); 211 showDrinks->MultiLineEdit1->append(s2);
diff --git a/noncore/apps/opie-console/io_bt.cpp b/noncore/apps/opie-console/io_bt.cpp
index 1a8c979..35a328f 100644
--- a/noncore/apps/opie-console/io_bt.cpp
+++ b/noncore/apps/opie-console/io_bt.cpp
@@ -1,92 +1,94 @@
1 1
2#include "io_bt.h" 2#include "io_bt.h"
3 3
4using namespace Opie::Core;
5using namespace Opie::Core;
4IOBt::IOBt( const Profile &config ) : IOSerial( config ) { 6IOBt::IOBt( const Profile &config ) : IOSerial( config ) {
5 m_attach = 0; 7 m_attach = 0;
6} 8}
7 9
8 10
9IOBt::~IOBt() { 11IOBt::~IOBt() {
10 if ( m_attach ) { 12 if ( m_attach ) {
11 delete m_attach; 13 delete m_attach;
12 } 14 }
13} 15}
14 16
15 17
16void IOBt::close() { 18void IOBt::close() {
17 19
18 IOSerial::close(); 20 IOSerial::close();
19 // still need error handling 21 // still need error handling
20 if ( m_attach ) { 22 if ( m_attach ) {
21 delete m_attach; 23 delete m_attach;
22 m_attach = 0; 24 m_attach = 0;
23 } 25 }
24} 26}
25 27
26bool IOBt::open() { 28bool IOBt::open() {
27 bool ret = false; 29 bool ret = false;
28 30
29 // only set up bt stuff if mac address was set, otherwise use the device set 31 // only set up bt stuff if mac address was set, otherwise use the device set
30 if ( !m_mac.isEmpty() ) { 32 if ( !m_mac.isEmpty() ) {
31 33
32 // now it should also be checked, if there is a connection to the device with that mac allready 34 // now it should also be checked, if there is a connection to the device with that mac allready
33 // hciattach here 35 // hciattach here
34 m_attach = new OProcess(); 36 m_attach = new OProcess();
35 *m_attach << "hciattach /dev/ttyS2 any 57600"; 37 *m_attach << "hciattach /dev/ttyS2 any 57600";
36 38
37 // then start hcid, then rcfomm handling (m_mac) 39 // then start hcid, then rcfomm handling (m_mac)
38 40
39 connect( m_attach, SIGNAL( processExited(OProcess*) ), 41 connect( m_attach, SIGNAL( processExited(Opie::Core::OProcess*) ),
40 this, SLOT( slotExited(OProcess*) ) ); 42 this, SLOT( slotExited(OProcess*) ) );
41 43
42 if ( m_attach->start() ) { 44 if ( m_attach->start() ) {
43 ret = IOSerial::open(); 45 ret = IOSerial::open();
44 } else { 46 } else {
45 qWarning("could not attach to device"); 47 qWarning("could not attach to device");
46 delete m_attach; 48 delete m_attach;
47 m_attach = 0; 49 m_attach = 0;
48 } 50 }
49 } else { 51 } else {
50 // directly to the normal serial 52 // directly to the normal serial
51 // TODO: look first if the connection really exists. ( is set up ) 53 // TODO: look first if the connection really exists. ( is set up )
52 54
53 ret =IOSerial::open(); 55 ret =IOSerial::open();
54 } 56 }
55 return ret; 57 return ret;
56} 58}
57 59
58void IOBt::reload( const Profile &config ) { 60void IOBt::reload( const Profile &config ) {
59 m_device = config.readEntry("Device", BT_DEFAULT_DEVICE); 61 m_device = config.readEntry("Device", BT_DEFAULT_DEVICE);
60 m_mac = config.readEntry("Mac", BT_DEFAULT_MAC); 62 m_mac = config.readEntry("Mac", BT_DEFAULT_MAC);
61 m_baud = config.readNumEntry("Baud", BT_DEFAULT_BAUD); 63 m_baud = config.readNumEntry("Baud", BT_DEFAULT_BAUD);
62 m_parity = config.readNumEntry("Parity", BT_DEFAULT_PARITY); 64 m_parity = config.readNumEntry("Parity", BT_DEFAULT_PARITY);
63 m_dbits = config.readNumEntry("DataBits", BT_DEFAULT_DBITS); 65 m_dbits = config.readNumEntry("DataBits", BT_DEFAULT_DBITS);
64 m_sbits = config.readNumEntry("StopBits", BT_DEFAULT_SBITS); 66 m_sbits = config.readNumEntry("StopBits", BT_DEFAULT_SBITS);
65 m_flow = config.readNumEntry("Flow", BT_DEFAULT_FLOW); 67 m_flow = config.readNumEntry("Flow", BT_DEFAULT_FLOW);
66} 68}
67 69
68 70
69QString IOBt::identifier() const { 71QString IOBt::identifier() const {
70 return "bluetooth"; 72 return "bluetooth";
71} 73}
72 74
73QString IOBt::name() const { 75QString IOBt::name() const {
74 return "BLuetooth IO Layer"; 76 return "BLuetooth IO Layer";
75} 77}
76 78
77void IOBt::slotExited( OProcess* proc ){ 79void IOBt::slotExited( OProcess* proc ){
78 close(); 80 close();
79 delete proc; 81 delete proc;
80} 82}
81 83
82QBitArray IOBt::supports() const { 84QBitArray IOBt::supports() const {
83 return QBitArray( 3 ); 85 return QBitArray( 3 );
84} 86}
85 87
86bool IOBt::isConnected() { 88bool IOBt::isConnected() {
87 return false; 89 return false;
88} 90}
89 91
90void IOBt::send(const QByteArray &data) { 92void IOBt::send(const QByteArray &data) {
91 qDebug( "Please overload me..." ); 93 qDebug( "Please overload me..." );
92} 94}
diff --git a/noncore/apps/opie-console/io_bt.h b/noncore/apps/opie-console/io_bt.h
index df6dd38..00ca7e5 100644
--- a/noncore/apps/opie-console/io_bt.h
+++ b/noncore/apps/opie-console/io_bt.h
@@ -1,51 +1,51 @@
1#ifndef OPIE_IO_BT 1#ifndef OPIE_IO_BT
2#define OPIE_IO_BT 2#define OPIE_IO_BT
3 3
4#include <opie2/oprocess.h> 4#include <opie2/oprocess.h>
5#include "io_serial.h" 5#include "io_serial.h"
6 6
7/* Default values to be used if the profile information is incomplete */ 7/* Default values to be used if the profile information is incomplete */
8#define BT_DEFAULT_DEVICE "/dev/ttyU0" 8#define BT_DEFAULT_DEVICE "/dev/ttyU0"
9#define BT_DEFAULT_BAUD 9600 9#define BT_DEFAULT_BAUD 9600
10#define BT_DEFAULT_PARITY 0 10#define BT_DEFAULT_PARITY 0
11#define BT_DEFAULT_DBITS 8 11#define BT_DEFAULT_DBITS 8
12#define BT_DEFAULT_SBITS 1 12#define BT_DEFAULT_SBITS 1
13#define BT_DEFAULT_FLOW 0 13#define BT_DEFAULT_FLOW 0
14#define BT_DEFAULT_MAC 0 14#define BT_DEFAULT_MAC 0
15 15
16 16
17/* IOSerial implements a RS232 IO Layer */ 17/* IOSerial implements a RS232 IO Layer */
18 18
19class IOBt : public IOSerial { 19class IOBt : public IOSerial {
20 20
21 Q_OBJECT 21 Q_OBJECT
22 22
23public: 23public:
24 24
25 IOBt(const Profile &); 25 IOBt(const Profile &);
26 ~IOBt(); 26 ~IOBt();
27 27
28 virtual QString identifier() const; 28 virtual QString identifier() const;
29 virtual QString name() const; 29 virtual QString name() const;
30 virtual QBitArray supports() const; 30 virtual QBitArray supports() const;
31 virtual bool isConnected(); 31 virtual bool isConnected();
32 32
33signals: 33signals:
34 void received(const QByteArray &); 34 void received(const QByteArray &);
35 void error(int, const QString &); 35 void error(int, const QString &);
36 36
37public slots: 37public slots:
38 virtual void send( const QByteArray& ); 38 virtual void send( const QByteArray& );
39 virtual bool open(); 39 virtual bool open();
40 virtual void close(); 40 virtual void close();
41 virtual void reload(const Profile &); 41 virtual void reload(const Profile &);
42 42
43private: 43private:
44 OProcess *m_attach; 44 Opie::Core::OProcess *m_attach;
45 QString m_mac; 45 QString m_mac;
46private slots: 46private slots:
47 void slotExited(OProcess* proc); 47 void slotExited(Opie::Core::OProcess* proc);
48 48
49}; 49};
50 50
51#endif /* OPIE_IO_IRDA */ 51#endif /* OPIE_IO_IRDA */
diff --git a/noncore/apps/opie-console/io_irda.cpp b/noncore/apps/opie-console/io_irda.cpp
index b281b7d..ba0b0e5 100644
--- a/noncore/apps/opie-console/io_irda.cpp
+++ b/noncore/apps/opie-console/io_irda.cpp
@@ -1,77 +1,79 @@
1 1
2#include "io_irda.h" 2#include "io_irda.h"
3 3
4using namespace Opie::Core;
5using namespace Opie::Core;
4IOIrda::IOIrda( const Profile &config ) : IOSerial( config ) { 6IOIrda::IOIrda( const Profile &config ) : IOSerial( config ) {
5 m_attach = 0; 7 m_attach = 0;
6} 8}
7 9
8 10
9IOIrda::~IOIrda() { 11IOIrda::~IOIrda() {
10 if ( m_attach ) { 12 if ( m_attach ) {
11 delete m_attach; 13 delete m_attach;
12 } 14 }
13} 15}
14 16
15 17
16void IOIrda::close() { 18void IOIrda::close() {
17 19
18 IOSerial::close(); 20 IOSerial::close();
19 // still need error handling 21 // still need error handling
20 delete m_attach; 22 delete m_attach;
21} 23}
22 24
23bool IOIrda::open() { 25bool IOIrda::open() {
24 bool ret; 26 bool ret;
25 27
26 // irdaattach here 28 // irdaattach here
27 m_attach = new OProcess(); 29 m_attach = new OProcess();
28 *m_attach << "irattach /dev/ttyS2 -s"; 30 *m_attach << "irattach /dev/ttyS2 -s";
29 31
30 connect( m_attach, SIGNAL( processExited(OProcess*) ), 32 connect( m_attach, SIGNAL( processExited(Opie::Core::OProcess*) ),
31 this, SLOT( slotExited(OProcess*) ) ); 33 this, SLOT( slotExited(OProcess*) ) );
32 34
33 if ( m_attach->start() ) { 35 if ( m_attach->start() ) {
34 ret= IOSerial::open(); 36 ret= IOSerial::open();
35 } else { 37 } else {
36 // emit error!!! 38 // emit error!!!
37 qWarning("could not attach to device"); 39 qWarning("could not attach to device");
38 delete m_attach; 40 delete m_attach;
39 m_attach = 0l; 41 m_attach = 0l;
40 } 42 }
41 return ret; 43 return ret;
42} 44}
43 45
44void IOIrda::reload( const Profile &config ) { 46void IOIrda::reload( const Profile &config ) {
45 m_device = config.readEntry("Device", IRDA_DEFAULT_DEVICE); 47 m_device = config.readEntry("Device", IRDA_DEFAULT_DEVICE);
46 m_baud = config.readNumEntry("Baud", IRDA_DEFAULT_BAUD); 48 m_baud = config.readNumEntry("Baud", IRDA_DEFAULT_BAUD);
47 m_parity = config.readNumEntry("Parity", IRDA_DEFAULT_PARITY); 49 m_parity = config.readNumEntry("Parity", IRDA_DEFAULT_PARITY);
48 m_dbits = config.readNumEntry("DataBits", IRDA_DEFAULT_DBITS); 50 m_dbits = config.readNumEntry("DataBits", IRDA_DEFAULT_DBITS);
49 m_sbits = config.readNumEntry("StopBits", IRDA_DEFAULT_SBITS); 51 m_sbits = config.readNumEntry("StopBits", IRDA_DEFAULT_SBITS);
50 m_flow = config.readNumEntry("Flow", IRDA_DEFAULT_FLOW); 52 m_flow = config.readNumEntry("Flow", IRDA_DEFAULT_FLOW);
51} 53}
52 54
53 55
54QString IOIrda::identifier() const { 56QString IOIrda::identifier() const {
55 return "irda"; 57 return "irda";
56} 58}
57 59
58QString IOIrda::name() const { 60QString IOIrda::name() const {
59 return "Irda IO Layer"; 61 return "Irda IO Layer";
60} 62}
61 63
62void IOIrda::slotExited(OProcess* proc ){ 64void IOIrda::slotExited(OProcess* proc ){
63 close(); 65 close();
64 delete proc; 66 delete proc;
65} 67}
66 68
67QBitArray IOIrda::supports()const { 69QBitArray IOIrda::supports()const {
68 return QBitArray( 3 ); 70 return QBitArray( 3 );
69} 71}
70 72
71bool IOIrda::isConnected() { 73bool IOIrda::isConnected() {
72 return false; 74 return false;
73} 75}
74 76
75void IOIrda::send(const QByteArray &data) { 77void IOIrda::send(const QByteArray &data) {
76 qDebug( "Please overload me..." ); 78 qDebug( "Please overload me..." );
77} 79}
diff --git a/noncore/apps/opie-console/io_irda.h b/noncore/apps/opie-console/io_irda.h
index 69bed7d..fb29686 100644
--- a/noncore/apps/opie-console/io_irda.h
+++ b/noncore/apps/opie-console/io_irda.h
@@ -1,49 +1,49 @@
1#ifndef OPIE_IO_IRDA 1#ifndef OPIE_IO_IRDA
2#define OPIE_IO_IRDA 2#define OPIE_IO_IRDA
3 3
4#include <opie2/oprocess.h> 4#include <opie2/oprocess.h>
5#include "io_serial.h" 5#include "io_serial.h"
6 6
7/* Default values to be used if the profile information is incomplete */ 7/* Default values to be used if the profile information is incomplete */
8#define IRDA_DEFAULT_DEVICE "/dev/ircomm0" 8#define IRDA_DEFAULT_DEVICE "/dev/ircomm0"
9#define IRDA_DEFAULT_BAUD 9600 9#define IRDA_DEFAULT_BAUD 9600
10#define IRDA_DEFAULT_PARITY 0 10#define IRDA_DEFAULT_PARITY 0
11#define IRDA_DEFAULT_DBITS 8 11#define IRDA_DEFAULT_DBITS 8
12#define IRDA_DEFAULT_SBITS 1 12#define IRDA_DEFAULT_SBITS 1
13#define IRDA_DEFAULT_FLOW 0 13#define IRDA_DEFAULT_FLOW 0
14 14
15/* IOSerial implements a RS232 IO Layer */ 15/* IOSerial implements a RS232 IO Layer */
16 16
17class IOIrda : public IOSerial { 17class IOIrda : public IOSerial {
18 18
19 Q_OBJECT 19 Q_OBJECT
20 20
21public: 21public:
22 22
23 IOIrda(const Profile &); 23 IOIrda(const Profile &);
24 ~IOIrda(); 24 ~IOIrda();
25 25
26 virtual QString identifier() const; 26 virtual QString identifier() const;
27 virtual QString name() const; 27 virtual QString name() const;
28 virtual QBitArray supports() const; 28 virtual QBitArray supports() const;
29 virtual bool isConnected(); 29 virtual bool isConnected();
30 30
31signals: 31signals:
32 void received(const QByteArray &); 32 void received(const QByteArray &);
33 void error(int, const QString &); 33 void error(int, const QString &);
34 34
35public slots: 35public slots:
36 virtual void send( const QByteArray& ); 36 virtual void send( const QByteArray& );
37 virtual bool open(); 37 virtual bool open();
38 virtual void close(); 38 virtual void close();
39 virtual void reload(const Profile &); 39 virtual void reload(const Profile &);
40 40
41private: 41private:
42 OProcess *m_attach; 42 Opie::Core::OProcess *m_attach;
43 43
44private slots: 44private slots:
45 void slotExited(OProcess* proc); 45 void slotExited(Opie::Core::OProcess* proc);
46 46
47}; 47};
48 48
49#endif /* OPIE_IO_IRDA */ 49#endif /* OPIE_IO_IRDA */
diff --git a/noncore/apps/opie-console/io_modem.cpp b/noncore/apps/opie-console/io_modem.cpp
index 1ce680a..b74d076 100644
--- a/noncore/apps/opie-console/io_modem.cpp
+++ b/noncore/apps/opie-console/io_modem.cpp
@@ -1,106 +1,108 @@
1 1
2#include "io_modem.h" 2#include "io_modem.h"
3 3
4#include "dialer.h" 4#include "dialer.h"
5 5
6using namespace Opie::Core;
7using namespace Opie::Core;
6IOModem::IOModem( const Profile &profile ) 8IOModem::IOModem( const Profile &profile )
7 : IOSerial( profile ) { 9 : IOSerial( profile ) {
8 m_profile = profile; 10 m_profile = profile;
9} 11}
10 12
11 13
12IOModem::~IOModem() { 14IOModem::~IOModem() {
13 15
14} 16}
15 17
16 18
17void IOModem::close() { 19void IOModem::close() {
18 // Hangup, discarding result 20 // Hangup, discarding result
19 //int fd = rawIO(); 21 //int fd = rawIO();
20 internDetach(); 22 internDetach();
21 Dialer d(m_profile, m_fd); 23 Dialer d(m_profile, m_fd);
22 d.setHangupOnly(); 24 d.setHangupOnly();
23 //d.exec(); 25 //d.exec();
24 internAttach(); 26 internAttach();
25 //closeRawIO(fd); 27 //closeRawIO(fd);
26 28
27 IOSerial::close(); 29 IOSerial::close();
28} 30}
29 31
30bool IOModem::open() { 32bool IOModem::open() {
31 bool ret = IOSerial::open(); 33 bool ret = IOSerial::open();
32 if(!ret) return false; 34 if(!ret) return false;
33 35
34 //int fd = rawIO(); 36 //int fd = rawIO();
35 internDetach(); 37 internDetach();
36 Dialer d(m_profile, m_fd); 38 Dialer d(m_profile, m_fd);
37 39
38 int result = d.exec(); 40 int result = d.exec();
39 internAttach(); 41 internAttach();
40 //closeRawIO(fd); 42 //closeRawIO(fd);
41 if(result == QDialog::Accepted) 43 if(result == QDialog::Accepted)
42 { 44 {
43 return true; 45 return true;
44 } 46 }
45 else 47 else
46 { 48 {
47 close(); 49 close();
48 return false; 50 return false;
49 } 51 }
50} 52}
51 53
52void IOModem::reload( const Profile &config ) { 54void IOModem::reload( const Profile &config ) {
53 55
54 m_device = config.readEntry("Device", MODEM_DEFAULT_DEVICE); 56 m_device = config.readEntry("Device", MODEM_DEFAULT_DEVICE);
55 m_baud = config.readNumEntry("Baud", MODEM_DEFAULT_BAUD); 57 m_baud = config.readNumEntry("Baud", MODEM_DEFAULT_BAUD);
56 m_parity = config.readNumEntry("Parity", MODEM_DEFAULT_PARITY); 58 m_parity = config.readNumEntry("Parity", MODEM_DEFAULT_PARITY);
57 m_dbits = config.readNumEntry("DataBits", MODEM_DEFAULT_DBITS); 59 m_dbits = config.readNumEntry("DataBits", MODEM_DEFAULT_DBITS);
58 m_sbits = config.readNumEntry("StopBits", MODEM_DEFAULT_SBITS); 60 m_sbits = config.readNumEntry("StopBits", MODEM_DEFAULT_SBITS);
59 m_flow = config.readNumEntry("Flow", MODEM_DEFAULT_FLOW); 61 m_flow = config.readNumEntry("Flow", MODEM_DEFAULT_FLOW);
60 62
61 m_initString = config.readEntry("InitString", MODEM_DEFAULT_INIT_STRING ); 63 m_initString = config.readEntry("InitString", MODEM_DEFAULT_INIT_STRING );
62 m_resetString = config.readEntry("ResetString", MODEM_DEFAULT_RESET_STRING ); 64 m_resetString = config.readEntry("ResetString", MODEM_DEFAULT_RESET_STRING );
63 m_dialPref1 = config.readEntry("DialPrefix1", MODEM_DEFAULT_DIAL_PREFIX1 ); 65 m_dialPref1 = config.readEntry("DialPrefix1", MODEM_DEFAULT_DIAL_PREFIX1 );
64 m_dialSuf1 = config.readEntry("DialSuffix1", MODEM_DEFAULT_DIAL_SUFFIX1 ); 66 m_dialSuf1 = config.readEntry("DialSuffix1", MODEM_DEFAULT_DIAL_SUFFIX1 );
65 m_dialPref2 = config.readEntry("DialPrefix2", MODEM_DEFAULT_DIAL_PREFIX1 ); 67 m_dialPref2 = config.readEntry("DialPrefix2", MODEM_DEFAULT_DIAL_PREFIX1 );
66 m_dialSuf2 = config.readEntry("DialSuffix2", MODEM_DEFAULT_DIAL_SUFFIX1 ); 68 m_dialSuf2 = config.readEntry("DialSuffix2", MODEM_DEFAULT_DIAL_SUFFIX1 );
67 m_dialPref3 = config.readEntry("DialPrefix3", MODEM_DEFAULT_DIAL_PREFIX1 ); 69 m_dialPref3 = config.readEntry("DialPrefix3", MODEM_DEFAULT_DIAL_PREFIX1 );
68 m_dialSuf3 = config.readEntry("DialSuffix3", MODEM_DEFAULT_DIAL_SUFFIX1 ); 70 m_dialSuf3 = config.readEntry("DialSuffix3", MODEM_DEFAULT_DIAL_SUFFIX1 );
69 m_connect = config.readEntry("DefaultConnect" MODEM_DEFAULT_CONNECT_STRING ); 71 m_connect = config.readEntry("DefaultConnect" MODEM_DEFAULT_CONNECT_STRING );
70 m_hangup = config.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING ); 72 m_hangup = config.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING );
71 m_cancel = config.readEntry("CancelString", MODEM_DEFAULT_CANCEL_STRING ); 73 m_cancel = config.readEntry("CancelString", MODEM_DEFAULT_CANCEL_STRING );
72 m_dialTime = config.readNumEntry("DialTime", MODEM_DEFAULT_DIAL_TIME ); 74 m_dialTime = config.readNumEntry("DialTime", MODEM_DEFAULT_DIAL_TIME );
73 m_delayRedial = config.readNumEntry("DelayRedial", MODEM_DEFAULT_DELAY_REDIAL ); 75 m_delayRedial = config.readNumEntry("DelayRedial", MODEM_DEFAULT_DELAY_REDIAL );
74 m_numberTries = config.readNumEntry("NumberTries", MODEM_DEFAULT_NUMBER_TRIES ); 76 m_numberTries = config.readNumEntry("NumberTries", MODEM_DEFAULT_NUMBER_TRIES );
75 m_dtrDropTime = config.readNumEntry("DTRDRopTime", MODEM_DEFAULT_DTR_DROP_TIME ); 77 m_dtrDropTime = config.readNumEntry("DTRDRopTime", MODEM_DEFAULT_DTR_DROP_TIME );
76 m_bpsDetect = config.readBoolEntry("BPSDetect", MODEM_DEFAULT_BPS_DETECT ); 78 m_bpsDetect = config.readBoolEntry("BPSDetect", MODEM_DEFAULT_BPS_DETECT );
77 m_dcdLines = config.readBoolEntry("DCDLines", MODEM_DEFAULT_DCD_LINES ); 79 m_dcdLines = config.readBoolEntry("DCDLines", MODEM_DEFAULT_DCD_LINES );
78 m_multiLineUntag = config.readBoolEntry("MultiLineUntag", MODEM_DEFAULT_MULTI_LINE_UNTAG ); 80 m_multiLineUntag = config.readBoolEntry("MultiLineUntag", MODEM_DEFAULT_MULTI_LINE_UNTAG );
79} 81}
80 82
81 83
82QString IOModem::identifier() const { 84QString IOModem::identifier() const {
83 return "modem"; 85 return "modem";
84} 86}
85 87
86QString IOModem::name() const { 88QString IOModem::name() const {
87 return "Modem IO Layer"; 89 return "Modem IO Layer";
88} 90}
89 91
90void IOModem::slotExited(OProcess* proc ){ 92void IOModem::slotExited(OProcess* proc ){
91 close(); 93 close();
92 /* delete it afterwards */ 94 /* delete it afterwards */
93 delete proc; 95 delete proc;
94} 96}
95 97
96QBitArray IOModem::supports()const { 98QBitArray IOModem::supports()const {
97 return QBitArray( 3 ); 99 return QBitArray( 3 );
98} 100}
99 101
100bool IOModem::isConnected() { 102bool IOModem::isConnected() {
101 return false; 103 return false;
102} 104}
103 105
104void IOModem::send(const QByteArray &data) { 106void IOModem::send(const QByteArray &data) {
105 qDebug( "Please overload me..." ); 107 qDebug( "Please overload me..." );
106} 108}
diff --git a/noncore/apps/opie-console/io_modem.h b/noncore/apps/opie-console/io_modem.h
index 96ec3ef..5b99e00 100644
--- a/noncore/apps/opie-console/io_modem.h
+++ b/noncore/apps/opie-console/io_modem.h
@@ -1,74 +1,74 @@
1#ifndef OPIE_IO_MODEM 1#ifndef OPIE_IO_MODEM
2#define OPIE_IO_MODEM 2#define OPIE_IO_MODEM
3 3
4#include <opie2/oprocess.h> 4#include <opie2/oprocess.h>
5#include "io_serial.h" 5#include "io_serial.h"
6#include "profile.h" 6#include "profile.h"
7 7
8/* Default values to be used if the profile information is incomplete */ 8/* Default values to be used if the profile information is incomplete */
9#define MODEM_DEFAULT_DEVICE "/dev/ttyS0" 9#define MODEM_DEFAULT_DEVICE "/dev/ttyS0"
10#define MODEM_DEFAULT_BAUD 9600 10#define MODEM_DEFAULT_BAUD 9600
11#define MODEM_DEFAULT_PARITY 0 11#define MODEM_DEFAULT_PARITY 0
12#define MODEM_DEFAULT_DBITS 8 12#define MODEM_DEFAULT_DBITS 8
13#define MODEM_DEFAULT_SBITS 1 13#define MODEM_DEFAULT_SBITS 1
14#define MODEM_DEFAULT_FLOW 0 14#define MODEM_DEFAULT_FLOW 0
15 15
16#define MODEM_DEFAULT_INIT_STRING "AT" 16#define MODEM_DEFAULT_INIT_STRING "AT"
17#define MODEM_DEFAULT_RESET_STRING "ATZ~" 17#define MODEM_DEFAULT_RESET_STRING "ATZ~"
18#define MODEM_DEFAULT_DIAL_PREFIX1 "ATDT" 18#define MODEM_DEFAULT_DIAL_PREFIX1 "ATDT"
19#define MODEM_DEFAULT_DIAL_SUFFIX1 "" 19#define MODEM_DEFAULT_DIAL_SUFFIX1 ""
20#define MODEM_DEFAULT_DIAL_PREFIX2 "" 20#define MODEM_DEFAULT_DIAL_PREFIX2 ""
21#define MODEM_DEFAULT_DIAL_SUFFIX2 "" 21#define MODEM_DEFAULT_DIAL_SUFFIX2 ""
22#define MODEM_DEFAULT_DIAL_PREFIX3 "" 22#define MODEM_DEFAULT_DIAL_PREFIX3 ""
23#define MODEM_DEFAULT_DIAL_SUFFIX3 "" 23#define MODEM_DEFAULT_DIAL_SUFFIX3 ""
24#define MODEM_DEFAULT_CONNECT_STRING "CONNECT" 24#define MODEM_DEFAULT_CONNECT_STRING "CONNECT"
25#define MODEM_DEFAULT_HANGUP_STRING "+++ATH" 25#define MODEM_DEFAULT_HANGUP_STRING "+++ATH"
26#define MODEM_DEFAULT_CANCEL_STRING "" 26#define MODEM_DEFAULT_CANCEL_STRING ""
27#define MODEM_DEFAULT_DIAL_TIME 45 27#define MODEM_DEFAULT_DIAL_TIME 45
28#define MODEM_DEFAULT_DELAY_REDIAL 2 28#define MODEM_DEFAULT_DELAY_REDIAL 2
29#define MODEM_DEFAULT_NUMBER_TRIES 10 29#define MODEM_DEFAULT_NUMBER_TRIES 10
30#define MODEM_DEFAULT_DTR_DROP_TIME 1 30#define MODEM_DEFAULT_DTR_DROP_TIME 1
31#define MODEM_DEFAULT_BPS_DETECT 0 // bool 31#define MODEM_DEFAULT_BPS_DETECT 0 // bool
32#define MODEM_DEFAULT_DCD_LINES 1 //bool 32#define MODEM_DEFAULT_DCD_LINES 1 //bool
33#define MODEM_DEFAULT_MULTI_LINE_UNTAG 0 // bool 33#define MODEM_DEFAULT_MULTI_LINE_UNTAG 0 // bool
34 34
35/* IOSerial implements a RS232 IO Layer */ 35/* IOSerial implements a RS232 IO Layer */
36 36
37class IOModem : public IOSerial { 37class IOModem : public IOSerial {
38 38
39 Q_OBJECT 39 Q_OBJECT
40 40
41public: 41public:
42 42
43 IOModem(const Profile &); 43 IOModem(const Profile &);
44 ~IOModem(); 44 ~IOModem();
45 45
46 virtual QString identifier() const; 46 virtual QString identifier() const;
47 virtual QString name() const; 47 virtual QString name() const;
48 virtual QBitArray supports() const; 48 virtual QBitArray supports() const;
49 virtual bool isConnected(); 49 virtual bool isConnected();
50 50
51signals: 51signals:
52 void received(const QByteArray &); 52 void received(const QByteArray &);
53 void error(int, const QString &); 53 void error(int, const QString &);
54 54
55public slots: 55public slots:
56 virtual void send( const QByteArray& ); 56 virtual void send( const QByteArray& );
57 virtual bool open(); 57 virtual bool open();
58 virtual void close(); 58 virtual void close();
59 virtual void reload(const Profile &); 59 virtual void reload(const Profile &);
60 60
61private: 61private:
62 62
63 QString m_initString, m_resetString, m_dialPref1, m_dialSuf1, m_dialPref2, 63 QString m_initString, m_resetString, m_dialPref1, m_dialSuf1, m_dialPref2,
64 m_dialSuf2, m_dialPref3, m_dialSuf3, m_connect, m_hangup, m_cancel; 64 m_dialSuf2, m_dialPref3, m_dialSuf3, m_connect, m_hangup, m_cancel;
65 int m_dialTime, m_delayRedial, m_numberTries, m_dtrDropTime, 65 int m_dialTime, m_delayRedial, m_numberTries, m_dtrDropTime,
66 m_bpsDetect, m_dcdLines, m_multiLineUntag; 66 m_bpsDetect, m_dcdLines, m_multiLineUntag;
67 Profile m_profile; 67 Profile m_profile;
68 68
69private slots: 69private slots:
70 void slotExited(OProcess* proc); 70 void slotExited(Opie::Core::OProcess* proc);
71 71
72}; 72};
73 73
74#endif 74#endif
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp
index 197f799..06a8f7d 100644
--- a/noncore/apps/opie-console/mainwindow.cpp
+++ b/noncore/apps/opie-console/mainwindow.cpp
@@ -1,727 +1,728 @@
1#include <assert.h> 1#include <assert.h>
2 2
3#include <qaction.h> 3#include <qaction.h>
4#include <qmenubar.h> 4#include <qmenubar.h>
5#include <qtoolbar.h> 5#include <qtoolbar.h>
6#include <qmessagebox.h> 6#include <qmessagebox.h>
7#include <qwhatsthis.h> 7#include <qwhatsthis.h>
8#include <qfileinfo.h> 8#include <qfileinfo.h>
9 9
10#include <qpe/filemanager.h> 10#include <qpe/filemanager.h>
11 11
12#include <opie2/ofiledialog.h> 12#include <opie2/ofiledialog.h>
13 13
14#include "TEmulation.h" 14#include "TEmulation.h"
15#include "profileeditordialog.h" 15#include "profileeditordialog.h"
16#include "configdialog.h" 16#include "configdialog.h"
17#include "default.h" 17#include "default.h"
18#include "profilemanager.h" 18#include "profilemanager.h"
19#include "mainwindow.h" 19#include "mainwindow.h"
20#include "tabwidget.h" 20#include "tabwidget.h"
21#include "transferdialog.h" 21#include "transferdialog.h"
22#include "function_keyboard.h" 22#include "function_keyboard.h"
23#include "emulation_handler.h" 23#include "emulation_handler.h"
24#include "script.h" 24#include "script.h"
25 25
26 26
27using namespace Opie::Ui;
27MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) { 28MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) {
28 KeyTrans::loadAll(); 29 KeyTrans::loadAll();
29 for (int i = 0; i < KeyTrans::count(); i++ ) { 30 for (int i = 0; i < KeyTrans::count(); i++ ) {
30 KeyTrans* s = KeyTrans::find(i ); 31 KeyTrans* s = KeyTrans::find(i );
31 assert( s ); 32 assert( s );
32 } 33 }
33 m_factory = new MetaFactory(); 34 m_factory = new MetaFactory();
34 Default def(m_factory); 35 Default def(m_factory);
35 m_sessions.setAutoDelete( TRUE ); 36 m_sessions.setAutoDelete( TRUE );
36 m_curSession = 0; 37 m_curSession = 0;
37 m_manager = new ProfileManager( m_factory ); 38 m_manager = new ProfileManager( m_factory );
38 m_manager->load(); 39 m_manager->load();
39 m_scriptsData.setAutoDelete(TRUE); 40 m_scriptsData.setAutoDelete(TRUE);
40 41
41 initUI(); 42 initUI();
42 populateProfiles(); 43 populateProfiles();
43 populateScripts(); 44 populateScripts();
44} 45}
45 46
46void MainWindow::initUI() { 47void MainWindow::initUI() {
47 48
48 setToolBarsMovable( FALSE ); 49 setToolBarsMovable( FALSE );
49 50
50 /* tool bar for the menu */ 51 /* tool bar for the menu */
51 m_tool = new QToolBar( this ); 52 m_tool = new QToolBar( this );
52 m_tool->setHorizontalStretchable( TRUE ); 53 m_tool->setHorizontalStretchable( TRUE );
53 54
54 m_bar = new QMenuBar( m_tool ); 55 m_bar = new QMenuBar( m_tool );
55 m_console = new QPopupMenu( this ); 56 m_console = new QPopupMenu( this );
56 m_scripts = new QPopupMenu( this ); 57 m_scripts = new QPopupMenu( this );
57 m_sessionsPop= new QPopupMenu( this ); 58 m_sessionsPop= new QPopupMenu( this );
58 m_scriptsPop = new QPopupMenu( this ); 59 m_scriptsPop = new QPopupMenu( this );
59 60
60 /* add a toolbar for icons */ 61 /* add a toolbar for icons */
61 m_icons = new QToolBar(this); 62 m_icons = new QToolBar(this);
62 63
63 /* 64 /*
64 * the settings action 65 * the settings action
65 */ 66 */
66 m_setProfiles = new QAction(tr("Configure Profiles"), 67 m_setProfiles = new QAction(tr("Configure Profiles"),
67 Resource::loadPixmap( "SettingsIcon" ), 68 Resource::loadPixmap( "SettingsIcon" ),
68 QString::null, 0, this, 0); 69 QString::null, 0, this, 0);
69 m_setProfiles->addTo( m_console ); 70 m_setProfiles->addTo( m_console );
70 connect( m_setProfiles, SIGNAL(activated() ), 71 connect( m_setProfiles, SIGNAL(activated() ),
71 this, SLOT(slotConfigure() ) ); 72 this, SLOT(slotConfigure() ) );
72 73
73 m_console->insertSeparator(); 74 m_console->insertSeparator();
74 /* 75 /*
75 * new Action for new sessions 76 * new Action for new sessions
76 */ 77 */
77 QAction* newCon = new QAction(tr("New Profile"), 78 QAction* newCon = new QAction(tr("New Profile"),
78 Resource::loadPixmap( "new" ), 79 Resource::loadPixmap( "new" ),
79 QString::null, 0, this, 0); 80 QString::null, 0, this, 0);
80 newCon->addTo( m_console ); 81 newCon->addTo( m_console );
81 connect( newCon, SIGNAL(activated() ), 82 connect( newCon, SIGNAL(activated() ),
82 this, SLOT(slotNew() ) ); 83 this, SLOT(slotNew() ) );
83 84
84 m_console->insertSeparator(); 85 m_console->insertSeparator();
85 86
86 QAction *saveCon = new QAction( tr("Save Profile" ), 87 QAction *saveCon = new QAction( tr("Save Profile" ),
87 Resource::loadPixmap( "save" ), QString::null, 88 Resource::loadPixmap( "save" ), QString::null,
88 0, this, 0 ); 89 0, this, 0 );
89 saveCon->addTo( m_console ); 90 saveCon->addTo( m_console );
90 connect( saveCon, SIGNAL(activated() ), 91 connect( saveCon, SIGNAL(activated() ),
91 this, SLOT(slotSaveSession() ) ); 92 this, SLOT(slotSaveSession() ) );
92 m_console->insertSeparator(); 93 m_console->insertSeparator();
93 94
94 /* 95 /*
95 * connect action 96 * connect action
96 */ 97 */
97 m_connect = new QAction( tr("Connect"), Resource::loadPixmap("console/connected"), 98 m_connect = new QAction( tr("Connect"), Resource::loadPixmap("console/connected"),
98 QString::null, 0, this, 0 ); 99 QString::null, 0, this, 0 );
99 m_connect->addTo( m_console ); 100 m_connect->addTo( m_console );
100 connect(m_connect, SIGNAL(activated() ), 101 connect(m_connect, SIGNAL(activated() ),
101 this, SLOT(slotConnect() ) ); 102 this, SLOT(slotConnect() ) );
102 103
103 /* 104 /*
104 * disconnect action 105 * disconnect action
105 */ 106 */
106 m_disconnect = new QAction( tr("Disconnect"), Resource::loadPixmap("console/notconnected"), 107 m_disconnect = new QAction( tr("Disconnect"), Resource::loadPixmap("console/notconnected"),
107 QString::null, 0, this, 0 ); 108 QString::null, 0, this, 0 );
108 m_disconnect->addTo( m_console ); 109 m_disconnect->addTo( m_console );
109 connect(m_disconnect, SIGNAL(activated() ), 110 connect(m_disconnect, SIGNAL(activated() ),
110 this, SLOT(slotDisconnect() ) ); 111 this, SLOT(slotDisconnect() ) );
111 112
112 m_console->insertSeparator(); 113 m_console->insertSeparator();
113 114
114 115
115 m_quickLaunch = new QAction( tr("QuickLaunch"), Resource::loadPixmap("console/konsole_mini"), QString::null, 0, this, 0 ); 116 m_quickLaunch = new QAction( tr("QuickLaunch"), Resource::loadPixmap("console/konsole_mini"), QString::null, 0, this, 0 );
116 m_quickLaunch->addTo( m_icons ); 117 m_quickLaunch->addTo( m_icons );
117 connect( m_quickLaunch, SIGNAL( activated() ), 118 connect( m_quickLaunch, SIGNAL( activated() ),
118 this, SLOT( slotQuickLaunch() ) ); 119 this, SLOT( slotQuickLaunch() ) );
119 120
120 QWhatsThis::add( m_icons, tr( "The shell button launches the \"default\" profile. If there is none default values are taken" ) ); 121 QWhatsThis::add( m_icons, tr( "The shell button launches the \"default\" profile. If there is none default values are taken" ) );
121 122
122 m_transfer = new QAction( tr("Transfer file..."), Resource::loadPixmap("pass") , QString::null, 123 m_transfer = new QAction( tr("Transfer file..."), Resource::loadPixmap("pass") , QString::null,
123 0, this, 0 ); 124 0, this, 0 );
124 m_transfer->addTo( m_console ); 125 m_transfer->addTo( m_console );
125 connect(m_transfer, SIGNAL(activated() ), 126 connect(m_transfer, SIGNAL(activated() ),
126 this, SLOT(slotTransfer() ) ); 127 this, SLOT(slotTransfer() ) );
127 128
128 129
129 130
130 /* 131 /*
131 * immediate change of line wrap policy 132 * immediate change of line wrap policy
132 */ 133 */
133 m_isWrapped = false; 134 m_isWrapped = false;
134 m_wrap = new QAction( tr("Line wrap"), Resource::loadPixmap( "linewrap" ), QString::null, 0, this, 0 ); 135 m_wrap = new QAction( tr("Line wrap"), Resource::loadPixmap( "linewrap" ), QString::null, 0, this, 0 );
135 m_wrap->addTo( m_console ); 136 m_wrap->addTo( m_console );
136 connect( m_wrap, SIGNAL( activated() ), SLOT( slotWrap() ) ); 137 connect( m_wrap, SIGNAL( activated() ), SLOT( slotWrap() ) );
137 138
138 /* 139 /*
139 * fullscreen 140 * fullscreen
140 */ 141 */
141 m_isFullscreen = false; 142 m_isFullscreen = false;
142 143
143 m_fullscreen = new QAction( tr("Full screen"), Resource::loadPixmap( "fullscreen" ) 144 m_fullscreen = new QAction( tr("Full screen"), Resource::loadPixmap( "fullscreen" )
144 , QString::null, 0, this, 0); 145 , QString::null, 0, this, 0);
145 m_fullscreen->addTo( m_console ); 146 m_fullscreen->addTo( m_console );
146 connect( m_fullscreen, SIGNAL( activated() ), 147 connect( m_fullscreen, SIGNAL( activated() ),
147 this, SLOT( slotFullscreen() ) ); 148 this, SLOT( slotFullscreen() ) );
148 149
149 m_console->insertSeparator(); 150 m_console->insertSeparator();
150 151
151 QAction *a = new QAction(); 152 QAction *a = new QAction();
152 a->setText( tr("Save history") ); 153 a->setText( tr("Save history") );
153 a->addTo( m_console ); 154 a->addTo( m_console );
154 connect(a, SIGNAL(activated() ), 155 connect(a, SIGNAL(activated() ),
155 this, SLOT(slotSaveHistory() ) ); 156 this, SLOT(slotSaveHistory() ) );
156 /* 157 /*
157 * terminate action 158 * terminate action
158 */ 159 */
159 m_terminate = new QAction(); 160 m_terminate = new QAction();
160 m_terminate->setText( tr("Terminate") ); 161 m_terminate->setText( tr("Terminate") );
161 m_terminate->addTo( m_console ); 162 m_terminate->addTo( m_console );
162 connect(m_terminate, SIGNAL(activated() ), 163 connect(m_terminate, SIGNAL(activated() ),
163 this, SLOT(slotTerminate() ) ); 164 this, SLOT(slotTerminate() ) );
164 165
165 m_closewindow = new QAction(); 166 m_closewindow = new QAction();
166 m_closewindow->setText( tr("Close Window") ); 167 m_closewindow->setText( tr("Close Window") );
167 m_closewindow->addTo( m_console ); 168 m_closewindow->addTo( m_console );
168 connect( m_closewindow, SIGNAL(activated() ), 169 connect( m_closewindow, SIGNAL(activated() ),
169 this, SLOT(slotClose() ) ); 170 this, SLOT(slotClose() ) );
170 171
171 172
172 /* 173 /*
173 * script actions 174 * script actions
174 */ 175 */
175 m_runScript_id = m_scripts->insertItem(tr("Run Script"), m_scriptsPop, -1, 0); 176 m_runScript_id = m_scripts->insertItem(tr("Run Script"), m_scriptsPop, -1, 0);
176 connect(m_scriptsPop, SIGNAL(activated(int)), this, SLOT(slotRunScript(int))); 177 connect(m_scriptsPop, SIGNAL(activated(int)), this, SLOT(slotRunScript(int)));
177 178
178 m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0); 179 m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0);
179 m_recordScript->addTo(m_scripts); 180 m_recordScript->addTo(m_scripts);
180 connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript())); 181 connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript()));
181 182
182 m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0); 183 m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0);
183 m_saveScript->addTo(m_scripts); 184 m_saveScript->addTo(m_scripts);
184 connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript())); 185 connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript()));
185 186
186 187
187 /* 188 /*
188 * action that open/closes the keyboard 189 * action that open/closes the keyboard
189 */ 190 */
190 m_openKeys = new QAction (tr("Open Keyboard..."), 191 m_openKeys = new QAction (tr("Open Keyboard..."),
191 Resource::loadPixmap( "console/keys/keyboard_icon" ), 192 Resource::loadPixmap( "console/keys/keyboard_icon" ),
192 QString::null, 0, this, 0); 193 QString::null, 0, this, 0);
193 m_openKeys->setToggleAction(true); 194 m_openKeys->setToggleAction(true);
194 connect (m_openKeys, SIGNAL(toggled(bool)), this, SLOT(slotOpenKeb(bool))); 195 connect (m_openKeys, SIGNAL(toggled(bool)), this, SLOT(slotOpenKeb(bool)));
195 196
196 /* insert the submenu */ 197 /* insert the submenu */
197 m_console->insertItem(tr("New from Profile"), m_sessionsPop, 198 m_console->insertItem(tr("New from Profile"), m_sessionsPop,
198 -1, 0); 199 -1, 0);
199 200
200 /* insert the connection menu */ 201 /* insert the connection menu */
201 m_bar->insertItem( tr("Connection"), m_console ); 202 m_bar->insertItem( tr("Connection"), m_console );
202 203
203 /* the scripts menu */ 204 /* the scripts menu */
204 m_bar->insertItem( tr("Scripts"), m_scripts ); 205 m_bar->insertItem( tr("Scripts"), m_scripts );
205 206
206 /* and the keyboard */ 207 /* and the keyboard */
207 m_keyBar = new QToolBar(this); 208 m_keyBar = new QToolBar(this);
208 addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); 209 addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE );
209 m_keyBar->setHorizontalStretchable( TRUE ); 210 m_keyBar->setHorizontalStretchable( TRUE );
210 m_keyBar->hide(); 211 m_keyBar->hide();
211 212
212 m_kb = new FunctionKeyboard(m_keyBar); 213 m_kb = new FunctionKeyboard(m_keyBar);
213 connect(m_kb, SIGNAL(keyPressed(FKey,ushort,ushort,bool)), 214 connect(m_kb, SIGNAL(keyPressed(FKey,ushort,ushort,bool)),
214 this, SLOT(slotKeyReceived(FKey,ushort,ushort,bool))); 215 this, SLOT(slotKeyReceived(FKey,ushort,ushort,bool)));
215 216
216 217
217 a = new QAction(tr("Copy"), 218 a = new QAction(tr("Copy"),
218 Resource::loadPixmap("copy"), QString::null, 219 Resource::loadPixmap("copy"), QString::null,
219 0, this, 0 ); 220 0, this, 0 );
220 //a->addTo( m_icons ); 221 //a->addTo( m_icons );
221 connect( a, SIGNAL(activated() ), 222 connect( a, SIGNAL(activated() ),
222 this, SLOT(slotCopy() ) ); 223 this, SLOT(slotCopy() ) );
223 224
224 QAction *paste = new QAction(tr("Paste"), 225 QAction *paste = new QAction(tr("Paste"),
225 Resource::loadPixmap("paste"), QString::null, 226 Resource::loadPixmap("paste"), QString::null,
226 0, this, 0 ); 227 0, this, 0 );
227 connect( paste, SIGNAL(activated() ), 228 connect( paste, SIGNAL(activated() ),
228 this, SLOT(slotPaste() ) ); 229 this, SLOT(slotPaste() ) );
229 230
230 231
231 newCon->addTo( m_icons ); 232 newCon->addTo( m_icons );
232 //m_setProfiles->addTo( m_icons ); 233 //m_setProfiles->addTo( m_icons );
233 paste->addTo( m_icons ); 234 paste->addTo( m_icons );
234 m_openKeys->addTo(m_icons); 235 m_openKeys->addTo(m_icons);
235 m_fullscreen->addTo( m_icons ); 236 m_fullscreen->addTo( m_icons );
236 237
237 m_connect->setEnabled( false ); 238 m_connect->setEnabled( false );
238 m_disconnect->setEnabled( false ); 239 m_disconnect->setEnabled( false );
239 m_terminate->setEnabled( false ); 240 m_terminate->setEnabled( false );
240 m_transfer->setEnabled( false ); 241 m_transfer->setEnabled( false );
241 m_scripts->setItemEnabled(m_runScript_id, false); 242 m_scripts->setItemEnabled(m_runScript_id, false);
242 m_recordScript->setEnabled( false ); 243 m_recordScript->setEnabled( false );
243 m_saveScript->setEnabled( false ); 244 m_saveScript->setEnabled( false );
244 m_fullscreen->setEnabled( false ); 245 m_fullscreen->setEnabled( false );
245 m_closewindow->setEnabled( false ); 246 m_closewindow->setEnabled( false );
246 m_wrap->setEnabled( false ); 247 m_wrap->setEnabled( false );
247 248
248 /* 249 /*
249 * connect to the menu activation 250 * connect to the menu activation
250 */ 251 */
251 connect( m_sessionsPop, SIGNAL(activated(int) ), 252 connect( m_sessionsPop, SIGNAL(activated(int) ),
252 this, SLOT(slotProfile(int) ) ); 253 this, SLOT(slotProfile(int) ) );
253 254
254 m_consoleWindow = new TabWidget( this, "blah"); 255 m_consoleWindow = new TabWidget( this, "blah");
255 connect(m_consoleWindow, SIGNAL(activated(Session*) ), 256 connect(m_consoleWindow, SIGNAL(activated(Session*) ),
256 this, SLOT(slotSessionChanged(Session*) ) ); 257 this, SLOT(slotSessionChanged(Session*) ) );
257 setCentralWidget( m_consoleWindow ); 258 setCentralWidget( m_consoleWindow );
258 259
259 slotQuickLaunch(); 260 slotQuickLaunch();
260} 261}
261 262
262ProfileManager* MainWindow::manager() { 263ProfileManager* MainWindow::manager() {
263 return m_manager; 264 return m_manager;
264} 265}
265TabWidget* MainWindow::tabWidget() { 266TabWidget* MainWindow::tabWidget() {
266 return m_consoleWindow; 267 return m_consoleWindow;
267} 268}
268void MainWindow::populateProfiles() { 269void MainWindow::populateProfiles() {
269 m_sessionsPop->clear(); 270 m_sessionsPop->clear();
270 Profile::ValueList list = manager()->all(); 271 Profile::ValueList list = manager()->all();
271 for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) { 272 for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) {
272 m_sessionsPop->insertItem( (*it).name() ); 273 m_sessionsPop->insertItem( (*it).name() );
273 } 274 }
274 275
275} 276}
276 277
277void MainWindow::populateScripts() { 278void MainWindow::populateScripts() {
278 m_scriptsPop->clear(); 279 m_scriptsPop->clear();
279 m_scriptsData.clear(); 280 m_scriptsData.clear();
280 DocLnkSet files(QPEApplication::documentDir(), "text/plain"); 281 DocLnkSet files(QPEApplication::documentDir(), "text/plain");
281 QListIterator<DocLnk> dit(files.children()); 282 QListIterator<DocLnk> dit(files.children());
282 for (; dit.current(); ++dit) { 283 for (; dit.current(); ++dit) {
283 if (*dit && (*dit)->name().length()>0) { 284 if (*dit && (*dit)->name().length()>0) {
284 QFileInfo info((*dit)->file()); 285 QFileInfo info((*dit)->file());
285 if (info.extension(false) == "script") { 286 if (info.extension(false) == "script") {
286 m_scriptsData.append(new DocLnk(**dit)); 287 m_scriptsData.append(new DocLnk(**dit));
287 m_scriptsPop->insertItem((*dit)->name()); 288 m_scriptsPop->insertItem((*dit)->name());
288 } 289 }
289 } 290 }
290 } 291 }
291 292
292} 293}
293 294
294MainWindow::~MainWindow() { 295MainWindow::~MainWindow() {
295 delete m_factory; 296 delete m_factory;
296 manager()->save(); 297 manager()->save();
297} 298}
298 299
299MetaFactory* MainWindow::factory() { 300MetaFactory* MainWindow::factory() {
300 return m_factory; 301 return m_factory;
301} 302}
302 303
303Session* MainWindow::currentSession() { 304Session* MainWindow::currentSession() {
304 return m_curSession; 305 return m_curSession;
305} 306}
306 307
307QList<Session> MainWindow::sessions() { 308QList<Session> MainWindow::sessions() {
308 return m_sessions; 309 return m_sessions;
309} 310}
310 311
311void MainWindow::slotNew() { 312void MainWindow::slotNew() {
312 ProfileEditorDialog dlg(factory() ); 313 ProfileEditorDialog dlg(factory() );
313 dlg.setCaption( tr("New Connection") ); 314 dlg.setCaption( tr("New Connection") );
314 int ret = QPEApplication::execDialog( &dlg ); 315 int ret = QPEApplication::execDialog( &dlg );
315 316
316 if ( ret == QDialog::Accepted ) { 317 if ( ret == QDialog::Accepted ) {
317 create( dlg.profile() ); 318 create( dlg.profile() );
318 } 319 }
319} 320}
320 321
321void MainWindow::slotRecordScript() { 322void MainWindow::slotRecordScript() {
322 if (currentSession()) { 323 if (currentSession()) {
323 currentSession()->emulationHandler()->startRecording(); 324 currentSession()->emulationHandler()->startRecording();
324 m_saveScript->setEnabled(true); 325 m_saveScript->setEnabled(true);
325 m_recordScript->setEnabled(false); 326 m_recordScript->setEnabled(false);
326 } 327 }
327} 328}
328 329
329void MainWindow::slotSaveScript() { 330void MainWindow::slotSaveScript() {
330 if (currentSession() && currentSession()->emulationHandler()->isRecording()) { 331 if (currentSession() && currentSession()->emulationHandler()->isRecording()) {
331 QMap<QString, QStringList> map; 332 QMap<QString, QStringList> map;
332 QStringList text; 333 QStringList text;
333 text << "text/plain"; 334 text << "text/plain";
334 map.insert(tr("Script"), text ); 335 map.insert(tr("Script"), text );
335 QString filename = Opie::OFileDialog::getSaveFileName(2, QPEApplication::documentDir(), QString::null, map); 336 QString filename = OFileDialog::getSaveFileName(2, QPEApplication::documentDir(), QString::null, map);
336 if (!filename.isEmpty()) { 337 if (!filename.isEmpty()) {
337 QFileInfo info(filename); 338 QFileInfo info(filename);
338 if (info.extension(FALSE) != "script") 339 if (info.extension(FALSE) != "script")
339 filename += ".script"; 340 filename += ".script";
340 DocLnk nf; 341 DocLnk nf;
341 nf.setType("text/plain"); 342 nf.setType("text/plain");
342 nf.setFile(filename); 343 nf.setFile(filename);
343 nf.setName(info.fileName()); 344 nf.setName(info.fileName());
344 FileManager fm; 345 FileManager fm;
345 fm.saveFile(nf, currentSession()->emulationHandler()->script()->script()); 346 fm.saveFile(nf, currentSession()->emulationHandler()->script()->script());
346 currentSession()->emulationHandler()->clearScript(); 347 currentSession()->emulationHandler()->clearScript();
347 m_saveScript->setEnabled(false); 348 m_saveScript->setEnabled(false);
348 m_recordScript->setEnabled(true); 349 m_recordScript->setEnabled(true);
349 populateScripts(); 350 populateScripts();
350 } 351 }
351 } 352 }
352} 353}
353 354
354void MainWindow::slotRunScript(int id) { 355void MainWindow::slotRunScript(int id) {
355 if (currentSession()) { 356 if (currentSession()) {
356 int index = m_scriptsPop->indexOf(id); 357 int index = m_scriptsPop->indexOf(id);
357 DocLnk *lnk = m_scriptsData.at(index); 358 DocLnk *lnk = m_scriptsData.at(index);
358 QString filePath = lnk->file(); 359 QString filePath = lnk->file();
359 Script script(filePath); 360 Script script(filePath);
360 currentSession()->emulationHandler()->runScript(&script); 361 currentSession()->emulationHandler()->runScript(&script);
361 } 362 }
362} 363}
363 364
364void MainWindow::slotConnect() { 365void MainWindow::slotConnect() {
365 if ( currentSession() ) { 366 if ( currentSession() ) {
366 bool ret = currentSession()->layer()->open(); 367 bool ret = currentSession()->layer()->open();
367 if(!ret) QMessageBox::warning(currentSession()->widgetStack(), 368 if(!ret) QMessageBox::warning(currentSession()->widgetStack(),
368 QObject::tr("Failed"), 369 QObject::tr("Failed"),
369 QObject::tr("Connecting failed for this session.")); 370 QObject::tr("Connecting failed for this session."));
370 else { 371 else {
371 m_connect->setEnabled( false ); 372 m_connect->setEnabled( false );
372 m_disconnect->setEnabled( true ); 373 m_disconnect->setEnabled( true );
373 374
374 // if it does not support file transfer, disable the menu entry 375 // if it does not support file transfer, disable the menu entry
375 if ( ( m_curSession->layer() )->supports()[1] == 0 ) { 376 if ( ( m_curSession->layer() )->supports()[1] == 0 ) {
376 m_transfer->setEnabled( false ); 377 m_transfer->setEnabled( false );
377 } else { 378 } else {
378 m_transfer->setEnabled( true ); 379 m_transfer->setEnabled( true );
379 } 380 }
380 381
381 m_recordScript->setEnabled( true ); 382 m_recordScript->setEnabled( true );
382 m_scripts->setItemEnabled(m_runScript_id, true); 383 m_scripts->setItemEnabled(m_runScript_id, true);
383 } 384 }
384 } 385 }
385} 386}
386 387
387void MainWindow::slotDisconnect() { 388void MainWindow::slotDisconnect() {
388 if ( currentSession() ) { 389 if ( currentSession() ) {
389 currentSession()->layer()->close(); 390 currentSession()->layer()->close();
390 m_connect->setEnabled( true ); 391 m_connect->setEnabled( true );
391 m_disconnect->setEnabled( false ); 392 m_disconnect->setEnabled( false );
392 m_transfer->setEnabled( false ); 393 m_transfer->setEnabled( false );
393 m_recordScript->setEnabled( false); 394 m_recordScript->setEnabled( false);
394 m_saveScript->setEnabled( false ); 395 m_saveScript->setEnabled( false );
395 m_scripts->setItemEnabled(m_runScript_id, false); 396 m_scripts->setItemEnabled(m_runScript_id, false);
396 } 397 }
397} 398}
398 399
399void MainWindow::slotTerminate() { 400void MainWindow::slotTerminate() {
400 if ( currentSession() ) 401 if ( currentSession() )
401 currentSession()->layer()->close(); 402 currentSession()->layer()->close();
402 403
403 slotClose(); 404 slotClose();
404 /* FIXME move to the next session */ 405 /* FIXME move to the next session */
405} 406}
406 407
407 408
408 409
409 410
410 411
411 412
412void MainWindow::slotQuickLaunch() { 413void MainWindow::slotQuickLaunch() {
413 Profile prof = manager()->profile( "default" ); 414 Profile prof = manager()->profile( "default" );
414 if ( prof.name() == "default" ) { 415 if ( prof.name() == "default" ) {
415 create( prof ); 416 create( prof );
416 } else { 417 } else {
417 Profile newProf = Profile( "default", "console", "default" , 0, 3, 0 ); 418 Profile newProf = Profile( "default", "console", "default" , 0, 3, 0 );
418 newProf.setAutoConnect( true ); 419 newProf.setAutoConnect( true );
419 create( newProf ); 420 create( newProf );
420 slotSaveSession(); 421 slotSaveSession();
421 } 422 }
422 423
423} 424}
424 425
425void MainWindow::slotConfigure() { 426void MainWindow::slotConfigure() {
426 ConfigDialog conf( manager()->all(), factory() ); 427 ConfigDialog conf( manager()->all(), factory() );
427 428
428 int ret = QPEApplication::execDialog( &conf ); 429 int ret = QPEApplication::execDialog( &conf );
429 430
430 if ( QDialog::Accepted == ret ) { 431 if ( QDialog::Accepted == ret ) {
431 manager()->setProfiles( conf.list() ); 432 manager()->setProfiles( conf.list() );
432 manager()->save(); 433 manager()->save();
433 populateProfiles(); 434 populateProfiles();
434 } 435 }
435} 436}
436/* 437/*
437 * we will remove 438 * we will remove
438 * this window from the tabwidget 439 * this window from the tabwidget
439 * remove it from the list 440 * remove it from the list
440 * delete it 441 * delete it
441 * and set the currentSession() 442 * and set the currentSession()
442 */ 443 */
443void MainWindow::slotClose() { 444void MainWindow::slotClose() {
444 if (!currentSession() ) 445 if (!currentSession() )
445 return; 446 return;
446 447
447 Session* ses = currentSession(); 448 Session* ses = currentSession();
448 qWarning("removing! currentSession %s", currentSession()->name().latin1() ); 449 qWarning("removing! currentSession %s", currentSession()->name().latin1() );
449 /* set to NULL to be safe, if its needed slotSessionChanged resets it automatically */ 450 /* set to NULL to be safe, if its needed slotSessionChanged resets it automatically */
450 m_curSession = NULL; 451 m_curSession = NULL;
451 tabWidget()->remove( /*currentSession()*/ses ); 452 tabWidget()->remove( /*currentSession()*/ses );
452 /*it's autodelete */ 453 /*it's autodelete */
453 m_sessions.remove( ses ); 454 m_sessions.remove( ses );
454 qWarning("after remove!!"); 455 qWarning("after remove!!");
455 456
456 if (!currentSession() ) { 457 if (!currentSession() ) {
457 m_connect->setEnabled( false ); 458 m_connect->setEnabled( false );
458 m_disconnect->setEnabled( false ); 459 m_disconnect->setEnabled( false );
459 m_terminate->setEnabled( false ); 460 m_terminate->setEnabled( false );
460 m_transfer->setEnabled( false ); 461 m_transfer->setEnabled( false );
461 m_recordScript->setEnabled( false ); 462 m_recordScript->setEnabled( false );
462 m_saveScript->setEnabled( false ); 463 m_saveScript->setEnabled( false );
463 m_scripts->setItemEnabled(m_runScript_id, false); 464 m_scripts->setItemEnabled(m_runScript_id, false);
464 m_fullscreen->setEnabled( false ); 465 m_fullscreen->setEnabled( false );
465 m_wrap->setEnabled( false ); 466 m_wrap->setEnabled( false );
466 m_closewindow->setEnabled( false ); 467 m_closewindow->setEnabled( false );
467 } 468 }
468 469
469 m_kb->loadDefaults(); 470 m_kb->loadDefaults();
470} 471}
471 472
472/* 473/*
473 * We will get the name 474 * We will get the name
474 * Then the profile 475 * Then the profile
475 * and then we will make a profile 476 * and then we will make a profile
476 */ 477 */
477void MainWindow::slotProfile( int id) { 478void MainWindow::slotProfile( int id) {
478 Profile prof = manager()->profile( m_sessionsPop->text( id) ); 479 Profile prof = manager()->profile( m_sessionsPop->text( id) );
479 create( prof ); 480 create( prof );
480} 481}
481 482
482 483
483 484
484void MainWindow::create( const Profile& prof ) { 485void MainWindow::create( const Profile& prof ) {
485 if(m_curSession) 486 if(m_curSession)
486 if(m_curSession->transferDialog()) m_curSession->transferDialog()->hide(); 487 if(m_curSession->transferDialog()) m_curSession->transferDialog()->hide();
487 488
488 Session *ses = manager()->fromProfile( prof, tabWidget() ); 489 Session *ses = manager()->fromProfile( prof, tabWidget() );
489 490
490 if((!ses) || (!ses->layer()) || (!ses->widgetStack())) 491 if((!ses) || (!ses->layer()) || (!ses->widgetStack()))
491 { 492 {
492 QMessageBox::warning(this, 493 QMessageBox::warning(this,
493 QObject::tr("Session failed"), 494 QObject::tr("Session failed"),
494 QObject::tr("<qt>Cannot open session: Not all components were found.</qt>")); 495 QObject::tr("<qt>Cannot open session: Not all components were found.</qt>"));
495 //if(ses) delete ses; 496 //if(ses) delete ses;
496 return; 497 return;
497 } 498 }
498 499
499 m_sessions.append( ses ); 500 m_sessions.append( ses );
500 tabWidget()->add( ses ); 501 tabWidget()->add( ses );
501 tabWidget()->repaint(); 502 tabWidget()->repaint();
502 m_curSession = ses; 503 m_curSession = ses;
503 504
504 // dicide if its a local term ( then no connction and no tranfer), maybe make a wrapper method out of it 505 // dicide if its a local term ( then no connction and no tranfer), maybe make a wrapper method out of it
505 m_connect->setEnabled( true ); 506 m_connect->setEnabled( true );
506 m_disconnect->setEnabled( false ); 507 m_disconnect->setEnabled( false );
507 m_terminate->setEnabled( true ); 508 m_terminate->setEnabled( true );
508 m_fullscreen->setEnabled( true ); 509 m_fullscreen->setEnabled( true );
509 m_wrap->setEnabled( true ); 510 m_wrap->setEnabled( true );
510 m_closewindow->setEnabled( true ); 511 m_closewindow->setEnabled( true );
511 m_transfer->setEnabled( false ); 512 m_transfer->setEnabled( false );
512 m_recordScript->setEnabled( false ); 513 m_recordScript->setEnabled( false );
513 m_saveScript->setEnabled( false ); 514 m_saveScript->setEnabled( false );
514 m_scripts->setItemEnabled(m_runScript_id, false); 515 m_scripts->setItemEnabled(m_runScript_id, false);
515 516
516 // is io_layer wants direct connection, then autoconnect 517 // is io_layer wants direct connection, then autoconnect
517 //if ( ( m_curSession->layer() )->supports()[0] == 1 ) { 518 //if ( ( m_curSession->layer() )->supports()[0] == 1 ) {
518 if (prof.autoConnect()) { 519 if (prof.autoConnect()) {
519 slotConnect(); 520 slotConnect();
520 } 521 }
521 522
522 523
523 QWidget *w = currentSession()->widget(); 524 QWidget *w = currentSession()->widget();
524 if(w) w->setFocus(); 525 if(w) w->setFocus();
525 526
526 if(currentSession()->profile().readNumEntry("Wrap", 80)){ 527 if(currentSession()->profile().readNumEntry("Wrap", 80)){
527 m_isWrapped = true; 528 m_isWrapped = true;
528 } else { 529 } else {
529 m_isWrapped = false; 530 m_isWrapped = false;
530 } 531 }
531 532
532 m_kb->load(currentSession()->profile()); 533 m_kb->load(currentSession()->profile());
533} 534}
534 535
535void MainWindow::slotTransfer() 536void MainWindow::slotTransfer()
536{ 537{
537 if ( currentSession() ) { 538 if ( currentSession() ) {
538 Session *mysession = currentSession(); 539 Session *mysession = currentSession();
539 TransferDialog dlg(/*mysession->widgetStack()*/this, this); 540 TransferDialog dlg(/*mysession->widgetStack()*/this, this);
540 mysession->setTransferDialog(&dlg); 541 mysession->setTransferDialog(&dlg);
541 //dlg.reparent(mysession->widgetStack(), QPoint(0, 0)); 542 //dlg.reparent(mysession->widgetStack(), QPoint(0, 0));
542 //dlg.showMaximized(); 543 //dlg.showMaximized();
543 currentSession()->widgetStack()->addWidget(&dlg, -1); 544 currentSession()->widgetStack()->addWidget(&dlg, -1);
544 dlg.show(); 545 dlg.show();
545 //dlg.exec(); 546 //dlg.exec();
546 while(dlg.isRunning()) qApp->processEvents(); 547 while(dlg.isRunning()) qApp->processEvents();
547 mysession->setTransferDialog(0l); 548 mysession->setTransferDialog(0l);
548 } 549 }
549} 550}
550 551
551 552
552void MainWindow::slotOpenKeb(bool state) { 553void MainWindow::slotOpenKeb(bool state) {
553 554
554 if (state) m_keyBar->show(); 555 if (state) m_keyBar->show();
555 else m_keyBar->hide(); 556 else m_keyBar->hide();
556 557
557} 558}
558 559
559 560
560void MainWindow::slotOpenButtons( bool state ) { 561void MainWindow::slotOpenButtons( bool state ) {
561 562
562 if ( state ) { 563 if ( state ) {
563 m_buttonBar->show(); 564 m_buttonBar->show();
564 } else { 565 } else {
565 m_buttonBar->hide(); 566 m_buttonBar->hide();
566 } 567 }
567} 568}
568 569
569 570
570 571
571void MainWindow::slotSessionChanged( Session* ses ) { 572void MainWindow::slotSessionChanged( Session* ses ) {
572 qWarning("changed!"); 573 qWarning("changed!");
573 574
574 if(m_curSession) 575 if(m_curSession)
575 if(m_curSession->transferDialog()) m_curSession->transferDialog()->hide(); 576 if(m_curSession->transferDialog()) m_curSession->transferDialog()->hide();
576 if(ses) 577 if(ses)
577 if(ses->transferDialog()) ses->transferDialog()->show(); 578 if(ses->transferDialog()) ses->transferDialog()->show();
578 579
579 if ( ses ) { 580 if ( ses ) {
580 m_curSession = ses; 581 m_curSession = ses;
581 qDebug(QString("is connected : %1").arg( m_curSession->layer()->isConnected() ) ); 582 qDebug(QString("is connected : %1").arg( m_curSession->layer()->isConnected() ) );
582 if ( m_curSession->layer()->isConnected() ) { 583 if ( m_curSession->layer()->isConnected() ) {
583 m_connect->setEnabled( false ); 584 m_connect->setEnabled( false );
584 m_disconnect->setEnabled( true ); 585 m_disconnect->setEnabled( true );
585 m_recordScript->setEnabled(!m_curSession->emulationHandler()->isRecording()); 586 m_recordScript->setEnabled(!m_curSession->emulationHandler()->isRecording());
586 m_saveScript->setEnabled(m_curSession->emulationHandler()->isRecording()); 587 m_saveScript->setEnabled(m_curSession->emulationHandler()->isRecording());
587 m_scripts->setItemEnabled(m_runScript_id, true); 588 m_scripts->setItemEnabled(m_runScript_id, true);
588 } else { 589 } else {
589 m_connect->setEnabled( true ); 590 m_connect->setEnabled( true );
590 m_disconnect->setEnabled( false ); 591 m_disconnect->setEnabled( false );
591 m_recordScript->setEnabled( false ); 592 m_recordScript->setEnabled( false );
592 m_saveScript->setEnabled( false ); 593 m_saveScript->setEnabled( false );
593 m_scripts->setItemEnabled(m_runScript_id, false); 594 m_scripts->setItemEnabled(m_runScript_id, false);
594 } 595 }
595 596
596 if ( ( m_curSession->layer() )->supports()[1] == 0 ) { 597 if ( ( m_curSession->layer() )->supports()[1] == 0 ) {
597 m_transfer->setEnabled( false ); 598 m_transfer->setEnabled( false );
598 } else { 599 } else {
599 m_transfer->setEnabled( true ); 600 m_transfer->setEnabled( true );
600 } 601 }
601 602
602 QWidget *w = m_curSession->widget(); 603 QWidget *w = m_curSession->widget();
603 if(w) w->setFocus(); 604 if(w) w->setFocus();
604 605
605 if(currentSession()->profile().readNumEntry("Wrap", 80)){ 606 if(currentSession()->profile().readNumEntry("Wrap", 80)){
606 m_isWrapped = true; 607 m_isWrapped = true;
607 } else { 608 } else {
608 m_isWrapped = false; 609 m_isWrapped = false;
609 } 610 }
610 611
611 m_kb->load(currentSession()->profile()); 612 m_kb->load(currentSession()->profile());
612 } 613 }
613} 614}
614 615
615void MainWindow::slotWrap() 616void MainWindow::slotWrap()
616{ 617{
617 if(m_curSession) 618 if(m_curSession)
618 { 619 {
619 EmulationHandler *e = m_curSession->emulationHandler(); 620 EmulationHandler *e = m_curSession->emulationHandler();
620 if(e) 621 if(e)
621 { 622 {
622 if(m_isWrapped) 623 if(m_isWrapped)
623 { 624 {
624 e->setWrap(80); 625 e->setWrap(80);
625 m_isWrapped = false; 626 m_isWrapped = false;
626 } 627 }
627 else 628 else
628 { 629 {
629 e->setWrap(0); 630 e->setWrap(0);
630 m_isWrapped = true; 631 m_isWrapped = true;
631 } 632 }
632 } 633 }
633 } 634 }
634} 635}
635 636
636void MainWindow::slotFullscreen() { 637void MainWindow::slotFullscreen() {
637 638
638 639
639 640
640 if ( m_isFullscreen ) { 641 if ( m_isFullscreen ) {
641 ( m_curSession->widgetStack() )->reparent( savedParentFullscreen, 0, QPoint(0,0), true ); 642 ( m_curSession->widgetStack() )->reparent( savedParentFullscreen, 0, QPoint(0,0), true );
642 ( m_curSession->widgetStack() )->resize( savedParentFullscreen->width(), savedParentFullscreen->height() ); 643 ( m_curSession->widgetStack() )->resize( savedParentFullscreen->width(), savedParentFullscreen->height() );
643 ( m_curSession->emulationHandler() )->cornerButton()->hide(); 644 ( m_curSession->emulationHandler() )->cornerButton()->hide();
644 disconnect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); 645 disconnect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) );
645 646
646 } else { 647 } else {
647 savedParentFullscreen = ( m_curSession->widgetStack() )->parentWidget(); 648 savedParentFullscreen = ( m_curSession->widgetStack() )->parentWidget();
648 ( m_curSession->widgetStack() )->setFrameStyle( QFrame::NoFrame ); 649 ( m_curSession->widgetStack() )->setFrameStyle( QFrame::NoFrame );
649 ( m_curSession->widgetStack() )->reparent( 0, WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop 650 ( m_curSession->widgetStack() )->reparent( 0, WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop
650 , QPoint(0,0), false ); 651 , QPoint(0,0), false );
651 ( m_curSession->widgetStack() )->resize( qApp->desktop()->width(), qApp->desktop()->height() ); 652 ( m_curSession->widgetStack() )->resize( qApp->desktop()->width(), qApp->desktop()->height() );
652 ( m_curSession->widgetStack() )->setFocus(); 653 ( m_curSession->widgetStack() )->setFocus();
653 ( m_curSession->widgetStack() )->show(); 654 ( m_curSession->widgetStack() )->show();
654 655
655 ( ( m_curSession->emulationHandler() )->cornerButton() )->show(); 656 ( ( m_curSession->emulationHandler() )->cornerButton() )->show();
656 657
657 connect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); 658 connect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) );
658 } 659 }
659 660
660 m_isFullscreen = !m_isFullscreen; 661 m_isFullscreen = !m_isFullscreen;
661} 662}
662 663
663 664
664void MainWindow::slotKeyReceived(FKey k, ushort, ushort, bool pressed) { 665void MainWindow::slotKeyReceived(FKey k, ushort, ushort, bool pressed) {
665 666
666 if ( m_curSession ) { 667 if ( m_curSession ) {
667 668
668 QEvent::Type state; 669 QEvent::Type state;
669 670
670 if (pressed) state = QEvent::KeyPress; 671 if (pressed) state = QEvent::KeyPress;
671 else state = QEvent::KeyRelease; 672 else state = QEvent::KeyRelease;
672 673
673 QKeyEvent ke(state, k.qcode, k.unicode, 0, QString(QChar(k.unicode))); 674 QKeyEvent ke(state, k.qcode, k.unicode, 0, QString(QChar(k.unicode)));
674 675
675 // is this the best way to do this? cant figure out any other way to work 676 // is this the best way to do this? cant figure out any other way to work
676 QApplication::sendEvent((QObject *)m_curSession->widget(), &ke); 677 QApplication::sendEvent((QObject *)m_curSession->widget(), &ke);
677 ke.ignore(); 678 ke.ignore();
678 } 679 }
679} 680}
680void MainWindow::slotCopy() { 681void MainWindow::slotCopy() {
681 if (!currentSession() ) return; 682 if (!currentSession() ) return;
682 currentSession()->emulationHandler()->copy(); 683 currentSession()->emulationHandler()->copy();
683} 684}
684void MainWindow::slotPaste() { 685void MainWindow::slotPaste() {
685 if (!currentSession() ) return; 686 if (!currentSession() ) return;
686 currentSession()->emulationHandler()->paste(); 687 currentSession()->emulationHandler()->paste();
687} 688}
688 689
689/* 690/*
690 * Save the session 691 * Save the session
691 */ 692 */
692 693
693void MainWindow::slotSaveSession() { 694void MainWindow::slotSaveSession() {
694 if (!currentSession() ) { 695 if (!currentSession() ) {
695 QMessageBox::information(this, tr("Save Connection"), 696 QMessageBox::information(this, tr("Save Connection"),
696 tr("<qt>There is no Connection.</qt>"), 1 ); 697 tr("<qt>There is no Connection.</qt>"), 1 );
697 return; 698 return;
698 } 699 }
699 manager()->add( currentSession()->profile() ); 700 manager()->add( currentSession()->profile() );
700 manager()->save(); 701 manager()->save();
701 populateProfiles(); 702 populateProfiles();
702} 703}
703void MainWindow::slotSaveHistory() { 704void MainWindow::slotSaveHistory() {
704 QMap<QString, QStringList> map; 705 QMap<QString, QStringList> map;
705 QStringList text; 706 QStringList text;
706 text << "text/plain"; 707 text << "text/plain";
707 map.insert(tr("History"), text ); 708 map.insert(tr("History"), text );
708 QString filename = Opie::OFileDialog::getSaveFileName(2, QPEApplication::documentDir(), QString::null, map); 709 QString filename = OFileDialog::getSaveFileName(2, QPEApplication::documentDir(), QString::null, map);
709 if (filename.isEmpty() ) return; 710 if (filename.isEmpty() ) return;
710 711
711 QFileInfo info(filename); 712 QFileInfo info(filename);
712 713
713 DocLnk nf; 714 DocLnk nf;
714 nf.setType("text/plain"); 715 nf.setType("text/plain");
715 nf.setFile(filename); 716 nf.setFile(filename);
716 nf.setName(info.fileName()); 717 nf.setName(info.fileName());
717 718
718 719
719 QFile file(filename); 720 QFile file(filename);
720 file.open(IO_WriteOnly ); 721 file.open(IO_WriteOnly );
721 QTextStream str(&file ); 722 QTextStream str(&file );
722 if ( currentSession() ) 723 if ( currentSession() )
723 currentSession()->emulationHandler()->emulation()->streamHistory(&str); 724 currentSession()->emulationHandler()->emulation()->streamHistory(&str);
724 725
725 file.close(); 726 file.close();
726 nf.writeLink(); 727 nf.writeLink();
727} 728}
diff --git a/noncore/apps/opie-console/profileeditordialog.cpp b/noncore/apps/opie-console/profileeditordialog.cpp
index 6e1e23e..dc42d8b 100644
--- a/noncore/apps/opie-console/profileeditordialog.cpp
+++ b/noncore/apps/opie-console/profileeditordialog.cpp
@@ -1,203 +1,204 @@
1#include <qlayout.h> 1#include <qlayout.h>
2#include <qlineedit.h> 2#include <qlineedit.h>
3#include <qlabel.h> 3#include <qlabel.h>
4#include <qmessagebox.h> 4#include <qmessagebox.h>
5#include <qcombobox.h> 5#include <qcombobox.h>
6#include <qcheckbox.h> 6#include <qcheckbox.h>
7#include <qscrollview.h> 7#include <qscrollview.h>
8 8
9#include "metafactory.h" 9#include "metafactory.h"
10#include "profileeditordialog.h" 10#include "profileeditordialog.h"
11 11
12using namespace Opie::Ui;
12namespace { 13namespace {
13 void setCurrent( const QString& str, QComboBox* bo ) { 14 void setCurrent( const QString& str, QComboBox* bo ) {
14 for (int i = 0; i < bo->count(); i++ ) { 15 for (int i = 0; i < bo->count(); i++ ) {
15 if ( bo->text(i) == str ) { 16 if ( bo->text(i) == str ) {
16 bo->setCurrentItem( i ); 17 bo->setCurrentItem( i );
17 } 18 }
18 } 19 }
19 }; 20 };
20} 21}
21 22
22ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact, 23ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact,
23 const Profile& prof ) 24 const Profile& prof )
24 : QDialog(0, 0, TRUE), m_fact( fact ), m_prof( prof ) 25 : QDialog(0, 0, TRUE), m_fact( fact ), m_prof( prof )
25{ 26{
26 initUI(); 27 initUI();
27 28
28 // Apply current profile 29 // Apply current profile
29 // plugin_plugin->load(profile); 30 // plugin_plugin->load(profile);
30 // ... (reset profile name line edit etc.) 31 // ... (reset profile name line edit etc.)
31} 32}
32 33
33ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact ) 34ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact )
34 : QDialog(0, 0, TRUE), m_fact( fact ) 35 : QDialog(0, 0, TRUE), m_fact( fact )
35{ 36{
36 // Default profile 37 // Default profile
37 m_prof = Profile(tr("New Profile"), "serial", "default", Profile::Black, Profile::White, Profile::VT102); 38 m_prof = Profile(tr("New Profile"), "serial", "default", Profile::Black, Profile::White, Profile::VT102);
38 39
39 initUI(); 40 initUI();
40 41
41 // Apply current profile 42 // Apply current profile
42 // plugin_plugin->load(profile); 43 // plugin_plugin->load(profile);
43} 44}
44 45
45Profile ProfileEditorDialog::profile() const 46Profile ProfileEditorDialog::profile() const
46{ 47{
47 return m_prof; 48 return m_prof;
48} 49}
49 50
50void ProfileEditorDialog::initUI() 51void ProfileEditorDialog::initUI()
51{ 52{
52 m_con = m_term = m_key = 0l; 53 m_con = m_term = m_key = 0l;
53 54
54 55
55 QVBoxLayout *mainLayout = new QVBoxLayout( this ); 56 QVBoxLayout *mainLayout = new QVBoxLayout( this );
56 tabWidget = new OTabWidget( this ); 57 tabWidget = new OTabWidget( this );
57 tabWidget->setTabStyle(OTabWidget::TextTab); 58 tabWidget->setTabStyle(OTabWidget::TextTab);
58 mainLayout->add(tabWidget); 59 mainLayout->add(tabWidget);
59 60
60 /* base tabs */ 61 /* base tabs */
61 tabprof = new QWidget(this); 62 tabprof = new QWidget(this);
62 m_tabTerm = new QWidget(this); 63 m_tabTerm = new QWidget(this);
63 m_tabCon = new QWidget(this); 64 m_tabCon = new QWidget(this);
64 m_tabKey = new QWidget(this); 65 m_tabKey = new QWidget(this);
65 66
66 m_svCon = new QScrollView( m_tabCon ); 67 m_svCon = new QScrollView( m_tabCon );
67 m_svCon->setResizePolicy( QScrollView::AutoOneFit ); 68 m_svCon->setResizePolicy( QScrollView::AutoOneFit );
68 //m_svCon->setHScrollBarMode( QScrollView::AlwaysOff ); 69 //m_svCon->setHScrollBarMode( QScrollView::AlwaysOff );
69 m_svCon->setFrameShape( QFrame::NoFrame ); 70 m_svCon->setFrameShape( QFrame::NoFrame );
70 m_svTerm = new QScrollView( m_tabTerm ); 71 m_svTerm = new QScrollView( m_tabTerm );
71 m_svTerm->setResizePolicy( QScrollView::AutoOneFit ); 72 m_svTerm->setResizePolicy( QScrollView::AutoOneFit );
72 //m_svTerm->setHScrollBarMode( QScrollView::AlwaysOff ); 73 //m_svTerm->setHScrollBarMode( QScrollView::AlwaysOff );
73 m_svTerm->setFrameShape( QFrame::NoFrame ); 74 m_svTerm->setFrameShape( QFrame::NoFrame );
74 75
75 /* base layout for tabs */ 76 /* base layout for tabs */
76 m_layCon = new QHBoxLayout( m_tabCon , 2 ); 77 m_layCon = new QHBoxLayout( m_tabCon , 2 );
77 m_layTerm = new QHBoxLayout( m_tabTerm, 2 ); 78 m_layTerm = new QHBoxLayout( m_tabTerm, 2 );
78 m_layKey = new QHBoxLayout( m_tabKey, 2 ); 79 m_layKey = new QHBoxLayout( m_tabKey, 2 );
79 80
80 m_layCon->addWidget( m_svCon ); 81 m_layCon->addWidget( m_svCon );
81 m_layTerm->addWidget( m_svTerm ); 82 m_layTerm->addWidget( m_svTerm );
82 83
83 // profile tab 84 // profile tab
84 85
85 QLabel *name = new QLabel(QObject::tr("Profile name"), tabprof); 86 QLabel *name = new QLabel(QObject::tr("Profile name"), tabprof);
86 m_name = new QLineEdit(tabprof); 87 m_name = new QLineEdit(tabprof);
87 QLabel *con = new QLabel(tr("Connection"), tabprof ); 88 QLabel *con = new QLabel(tr("Connection"), tabprof );
88 QLabel *term = new QLabel(tr("Terminal"), tabprof ); 89 QLabel *term = new QLabel(tr("Terminal"), tabprof );
89 m_conCmb = new QComboBox( tabprof ); 90 m_conCmb = new QComboBox( tabprof );
90 m_termCmb = new QComboBox( tabprof ); 91 m_termCmb = new QComboBox( tabprof );
91 m_autoConnect = new QCheckBox(tr("Auto connect after load"), tabprof); 92 m_autoConnect = new QCheckBox(tr("Auto connect after load"), tabprof);
92 93
93 // layouting 94 // layouting
94 QVBoxLayout *vbox3 = new QVBoxLayout(tabprof, 2); 95 QVBoxLayout *vbox3 = new QVBoxLayout(tabprof, 2);
95 vbox3->add(name); 96 vbox3->add(name);
96 vbox3->add(m_name); 97 vbox3->add(m_name);
97 vbox3->add(con ); 98 vbox3->add(con );
98 vbox3->add(m_conCmb ); 99 vbox3->add(m_conCmb );
99 vbox3->add(term ); 100 vbox3->add(term );
100 vbox3->add(m_termCmb ); 101 vbox3->add(m_termCmb );
101 vbox3->add(m_autoConnect); 102 vbox3->add(m_autoConnect);
102 vbox3->addStretch(1); 103 vbox3->addStretch(1);
103 104
104 m_showconntab = 0; 105 m_showconntab = 0;
105 tabWidget->addTab(tabprof, "", QObject::tr("Profile")); 106 tabWidget->addTab(tabprof, "", QObject::tr("Profile"));
106 tabWidget->addTab(m_tabCon, "", QObject::tr("Connection")); 107 tabWidget->addTab(m_tabCon, "", QObject::tr("Connection"));
107 tabWidget->addTab(m_tabTerm, "", QObject::tr("Terminal")); 108 tabWidget->addTab(m_tabTerm, "", QObject::tr("Terminal"));
108 tabWidget->addTab(m_tabKey, "", QObject::tr("Special Keys")); 109 tabWidget->addTab(m_tabKey, "", QObject::tr("Special Keys"));
109 tabWidget->setCurrentTab( tabprof ); 110 tabWidget->setCurrentTab( tabprof );
110 111
111 112
112 // fill the comboboxes 113 // fill the comboboxes
113 QStringList list = m_fact->connectionWidgets(); 114 QStringList list = m_fact->connectionWidgets();
114 QStringList::Iterator it; 115 QStringList::Iterator it;
115 for (it =list.begin(); it != list.end(); ++it ) { 116 for (it =list.begin(); it != list.end(); ++it ) {
116 m_conCmb->insertItem( (*it) ); 117 m_conCmb->insertItem( (*it) );
117 } 118 }
118 list = m_fact->terminalWidgets(); 119 list = m_fact->terminalWidgets();
119 for (it =list.begin(); it != list.end(); ++it ) { 120 for (it =list.begin(); it != list.end(); ++it ) {
120 m_termCmb->insertItem( (*it) ); 121 m_termCmb->insertItem( (*it) );
121 } 122 }
122 123
123 // load profile values 124 // load profile values
124 m_name->setText(m_prof.name()); 125 m_name->setText(m_prof.name());
125 slotKeyActivated( "Default Keyboard" ); 126 slotKeyActivated( "Default Keyboard" );
126 setCurrent( m_fact->external(m_prof.ioLayerName() ), m_conCmb ); 127 setCurrent( m_fact->external(m_prof.ioLayerName() ), m_conCmb );
127 setCurrent( m_fact->external(m_prof.terminalName() ), m_termCmb ); 128 setCurrent( m_fact->external(m_prof.terminalName() ), m_termCmb );
128 slotConActivated( m_fact->external(m_prof.ioLayerName() ) ); 129 slotConActivated( m_fact->external(m_prof.ioLayerName() ) );
129 slotTermActivated( m_fact->external(m_prof.terminalName() ) ); 130 slotTermActivated( m_fact->external(m_prof.terminalName() ) );
130 m_autoConnect->setChecked(m_prof.autoConnect()); 131 m_autoConnect->setChecked(m_prof.autoConnect());
131 132
132 133
133 // signal and slots 134 // signal and slots
134 connect(m_conCmb, SIGNAL(activated(const QString&) ), 135 connect(m_conCmb, SIGNAL(activated(const QString&) ),
135 this, SLOT(slotConActivated(const QString&) ) ); 136 this, SLOT(slotConActivated(const QString&) ) );
136 connect(m_termCmb, SIGNAL(activated(const QString&) ), 137 connect(m_termCmb, SIGNAL(activated(const QString&) ),
137 this, SLOT(slotTermActivated(const QString&) ) ); 138 this, SLOT(slotTermActivated(const QString&) ) );
138 139
139} 140}
140 141
141ProfileEditorDialog::~ProfileEditorDialog() { 142ProfileEditorDialog::~ProfileEditorDialog() {
142 143
143} 144}
144void ProfileEditorDialog::accept() 145void ProfileEditorDialog::accept()
145{ 146{
146 if(profName().isEmpty()) 147 if(profName().isEmpty())
147 { 148 {
148 QMessageBox::information(this, 149 QMessageBox::information(this,
149 QObject::tr("Invalid profile"), 150 QObject::tr("Invalid profile"),
150 QObject::tr("Please enter a profile name.")); 151 QObject::tr("Please enter a profile name."));
151 return; 152 return;
152 } 153 }
153 // Save profile and plugin profile 154 // Save profile and plugin profile
154 //if(plugin_plugin) plugin_plugin->save(); 155 //if(plugin_plugin) plugin_plugin->save();
155 156
156 // Save general values 157 // Save general values
157 m_prof.setName( profName() ); 158 m_prof.setName( profName() );
158 m_prof.setIOLayer( m_fact->internal(m_conCmb ->currentText() ) ); 159 m_prof.setIOLayer( m_fact->internal(m_conCmb ->currentText() ) );
159 m_prof.setTerminalName( m_fact->internal(m_termCmb->currentText() ) ); 160 m_prof.setTerminalName( m_fact->internal(m_termCmb->currentText() ) );
160 m_prof.setAutoConnect( m_autoConnect->isChecked() ); 161 m_prof.setAutoConnect( m_autoConnect->isChecked() );
161 162
162 if (m_con ) 163 if (m_con )
163 m_con->save( m_prof ); 164 m_con->save( m_prof );
164 if (m_term ) 165 if (m_term )
165 m_term->save( m_prof ); 166 m_term->save( m_prof );
166 if (m_key) 167 if (m_key)
167 m_key->save( m_prof ); 168 m_key->save( m_prof );
168 169
169 QDialog::accept(); 170 QDialog::accept();
170} 171}
171 172
172 173
173QString ProfileEditorDialog::profName()const 174QString ProfileEditorDialog::profName()const
174{ 175{
175 return m_name->text(); 176 return m_name->text();
176} 177}
177 178
178QCString ProfileEditorDialog::profType()const 179QCString ProfileEditorDialog::profType()const
179{ 180{
180 /*QStringList w = m_fact->configWidgets(); 181 /*QStringList w = m_fact->configWidgets();
181 for(QStringList::Iterator it = w.begin(); it != w.end(); it++) 182 for(QStringList::Iterator it = w.begin(); it != w.end(); it++)
182 if(device_box->currentText() == m_fact->name((*it))) return (*it); 183 if(device_box->currentText() == m_fact->name((*it))) return (*it);
183 */ 184 */
184 return QCString(); 185 return QCString();
185} 186}
186/* 187/*
187 * we need to switch the widget 188 * we need to switch the widget
188 */ 189 */
189void ProfileEditorDialog::slotConActivated( const QString& str ) { 190void ProfileEditorDialog::slotConActivated( const QString& str ) {
190 191
191 delete m_con; 192 delete m_con;
192 193
193 m_con = m_fact->newConnectionPlugin( str, m_svCon->viewport() ); 194 m_con = m_fact->newConnectionPlugin( str, m_svCon->viewport() );
194 195
195 if ( !m_con ) { 196 if ( !m_con ) {
196 m_con = new NoOptions( str, m_svCon->viewport(), "name"); 197 m_con = new NoOptions( str, m_svCon->viewport(), "name");
197 } 198 }
198 199
199 // FIXME ugly hack right. Right solution would be to look into the layer and see if it 200 // FIXME ugly hack right. Right solution would be to look into the layer and see if it
200 // supports auto connect and then set it as prefered 201 // supports auto connect and then set it as prefered
201 if ( m_conCmb ->currentText() == tr("Local Console") ) { 202 if ( m_conCmb ->currentText() == tr("Local Console") ) {
202 m_autoConnect->setChecked( true ); 203 m_autoConnect->setChecked( true );
203 m_prof.writeEntry("Terminal", Profile::Linux ); 204 m_prof.writeEntry("Terminal", Profile::Linux );
diff --git a/noncore/apps/opie-console/profileeditordialog.h b/noncore/apps/opie-console/profileeditordialog.h
index 97bd650..e7a88e9 100644
--- a/noncore/apps/opie-console/profileeditordialog.h
+++ b/noncore/apps/opie-console/profileeditordialog.h
@@ -1,61 +1,61 @@
1#ifndef PROFILE_EDITOR_DIALOG 1#ifndef PROFILE_EDITOR_DIALOG
2#define PROFILE_EDITOR_DIALOG 2#define PROFILE_EDITOR_DIALOG
3 3
4#include <qdialog.h> 4#include <qdialog.h>
5#include <opie2/otabwidget.h> 5#include <opie2/otabwidget.h>
6 6
7#include "profile.h" 7#include "profile.h"
8 8
9class MetaFactory; 9class MetaFactory;
10class EditBase; 10class EditBase;
11class QTabWidget; 11class QTabWidget;
12class QHBoxLayout; 12class QHBoxLayout;
13class QLineEdit; 13class QLineEdit;
14class QComboBox; 14class QComboBox;
15class QCheckBox; 15class QCheckBox;
16class QLabel; 16class QLabel;
17class QScrollView; 17class QScrollView;
18class ProfileDialogWidget; 18class ProfileDialogWidget;
19 19
20class ProfileEditorDialog : public QDialog { 20class ProfileEditorDialog : public QDialog {
21 Q_OBJECT 21 Q_OBJECT
22public: 22public:
23 ProfileEditorDialog(MetaFactory* fact, 23 ProfileEditorDialog(MetaFactory* fact,
24 const Profile& prof ); 24 const Profile& prof );
25 ProfileEditorDialog(MetaFactory* fact ); 25 ProfileEditorDialog(MetaFactory* fact );
26 ~ProfileEditorDialog(); 26 ~ProfileEditorDialog();
27 Profile profile()const; 27 Profile profile()const;
28 28
29 29
30 30
31public slots: 31public slots:
32 void accept(); 32 void accept();
33 33
34private slots: 34private slots:
35 void slotConActivated(const QString& ); 35 void slotConActivated(const QString& );
36 void slotTermActivated( const QString& ); 36 void slotTermActivated( const QString& );
37 void slotKeyActivated(const QString&); 37 void slotKeyActivated(const QString&);
38private: 38private:
39 void initUI(); 39 void initUI();
40 QString profName()const; 40 QString profName()const;
41 QCString profType()const; 41 QCString profType()const;
42 42
43 MetaFactory* m_fact; 43 MetaFactory* m_fact;
44 QHBoxLayout* m_lay; 44 QHBoxLayout* m_lay;
45 Profile m_prof; 45 Profile m_prof;
46 46
47 QLineEdit *m_name; 47 QLineEdit *m_name;
48 QComboBox *m_conCmb, *m_termCmb; 48 QComboBox *m_conCmb, *m_termCmb;
49 QCheckBox *m_autoConnect; 49 QCheckBox *m_autoConnect;
50 50
51 QScrollView *m_svCon, *m_svTerm; 51 QScrollView *m_svCon, *m_svTerm;
52 52
53 QWidget *m_tabCon, *m_tabTerm, *m_tabKey; 53 QWidget *m_tabCon, *m_tabTerm, *m_tabKey;
54 ProfileDialogWidget* m_con, *m_term, *m_key; 54 ProfileDialogWidget* m_con, *m_term, *m_key;
55 QHBoxLayout *m_layCon, *m_layTerm, *m_layKey; 55 QHBoxLayout *m_layCon, *m_layTerm, *m_layKey;
56 OTabWidget *tabWidget; 56 Opie::Ui::OTabWidget *tabWidget;
57 QWidget *tabprof; 57 QWidget *tabprof;
58 int m_showconntab; 58 int m_showconntab;
59}; 59};
60 60
61#endif 61#endif
diff --git a/noncore/apps/opie-console/sz_transfer.cpp b/noncore/apps/opie-console/sz_transfer.cpp
index 2f82417..5958e93 100644
--- a/noncore/apps/opie-console/sz_transfer.cpp
+++ b/noncore/apps/opie-console/sz_transfer.cpp
@@ -1,84 +1,86 @@
1 1
2#include "sz_transfer.h" 2#include "sz_transfer.h"
3#include <qfile.h> 3#include <qfile.h>
4#include <stdio.h> 4#include <stdio.h>
5#include <sys/termios.h> 5#include <sys/termios.h>
6 6
7 7
8 8
9using namespace Opie::Core;
10using namespace Opie::Core;
9SzTransfer::SzTransfer(Type t, IOLayer *layer) : FileTransferLayer(layer), m_t(t) 11SzTransfer::SzTransfer(Type t, IOLayer *layer) : FileTransferLayer(layer), m_t(t)
10{ 12{
11} 13}
12 14
13SzTransfer::~SzTransfer() { 15SzTransfer::~SzTransfer() {
14} 16}
15 17
16void SzTransfer::sendFile(const QFile& file) { 18void SzTransfer::sendFile(const QFile& file) {
17 19
18 sendFile(file.name()); 20 sendFile(file.name());
19} 21}
20 22
21void SzTransfer::sendFile(const QString& file) { 23void SzTransfer::sendFile(const QString& file) {
22 24
23 //setcbreak(2); /* raw no echo */ 25 //setcbreak(2); /* raw no echo */
24 26
25 proc = new OProcess; 27 proc = new OProcess;
26 *proc << "sz"; 28 *proc << "sz";
27 *proc << "-v" << "-v" << "-b" << file; 29 *proc << "-v" << "-v" << "-b" << file;
28 connect(proc, SIGNAL(processExited(OProcess*)), 30 connect(proc, SIGNAL(processExited(Opie::Core::OProcess*)),
29 this, SLOT(sent())); 31 this, SLOT(sent()));
30 connect(proc, SIGNAL(receivedStdout(OProcess*,char*,int)), 32 connect(proc, SIGNAL(receivedStdout(Opie::Core::OProcess*,char*,int)),
31 this, SLOT(SzReceivedStdout(OProcess*,char*,int))); 33 this, SLOT(SzReceivedStdout(OProcess*,char*,int)));
32 connect(proc, SIGNAL(receivedStderr(OProcess*,char*,int)), 34 connect(proc, SIGNAL(receivedStderr(Opie::Core::OProcess*,char*,int)),
33 this, SLOT(SzReceivedStderr(OProcess*,char*,int))); 35 this, SLOT(SzReceivedStderr(OProcess*,char*,int)));
34 connect(layer(), SIGNAL(received(const QByteArray&)), 36 connect(layer(), SIGNAL(received(const QByteArray&)),
35 this, SLOT(receivedStdin(const QByteArray&))); 37 this, SLOT(receivedStdin(const QByteArray&)));
36 proc->start(OProcess::NotifyOnExit, OProcess::All); 38 proc->start(OProcess::NotifyOnExit, OProcess::All);
37 39
38} 40}
39 41
40void SzTransfer::SzReceivedStdout(OProcess *, char *buffer, int buflen) { 42void SzTransfer::SzReceivedStdout(OProcess *, char *buffer, int buflen) {
41 43
42 qWarning("recieved from sz on stdout %d bytes", buflen); 44 qWarning("recieved from sz on stdout %d bytes", buflen);
43 45
44 QByteArray data(buflen); 46 QByteArray data(buflen);
45 data.fill(*buffer, buflen); 47 data.fill(*buffer, buflen);
46 for (uint i = 0; i < data.count(); i++ ) { 48 for (uint i = 0; i < data.count(); i++ ) {
47 printf("%c", buffer[i] ); 49 printf("%c", buffer[i] );
48 } 50 }
49 printf("\n"); 51 printf("\n");
50 52
51 // send out through the io layer 53 // send out through the io layer
52 layer()->send(data); 54 layer()->send(data);
53} 55}
54 56
55void SzTransfer::SzReceivedStderr(OProcess *, char *buffer, int length) { 57void SzTransfer::SzReceivedStderr(OProcess *, char *buffer, int length) {
56 58
57 // parse and show data in a progress dialog/widget 59 // parse and show data in a progress dialog/widget
58 printf("stderr:\n"); 60 printf("stderr:\n");
59 //for (int i = 0; i < length; i++) 61 //for (int i = 0; i < length; i++)
60 // printf("%c", buffer[i]); 62 // printf("%c", buffer[i]);
61 //printf("\n"); 63 //printf("\n");
62} 64}
63 65
64void SzTransfer::receivedStdin(const QByteArray &data) { 66void SzTransfer::receivedStdin(const QByteArray &data) {
65 67
66 qWarning("recieved from io_serial %d bytes", data.size()); 68 qWarning("recieved from io_serial %d bytes", data.size());
67 69
68 // recieved data from the io layer goes to sz 70 // recieved data from the io layer goes to sz
69 proc->writeStdin(data.data(), data.size()); 71 proc->writeStdin(data.data(), data.size());
70 72
71} 73}
72 74
73void SzTransfer::sent() { 75void SzTransfer::sent() {
74 76
75 qWarning("sent file"); 77 qWarning("sent file");
76 78
77 //setcbreak(0); /* default */ 79 //setcbreak(0); /* default */
78 80
79 81
80 delete proc; 82 delete proc;
81 disconnect(layer(), SIGNAL(received(const QByteArray&)), 83 disconnect(layer(), SIGNAL(received(const QByteArray&)),
82 this, SLOT(receivedStdin(const QByteArray&))); 84 this, SLOT(receivedStdin(const QByteArray&)));
83 85
84} 86}
diff --git a/noncore/apps/opie-console/sz_transfer.h b/noncore/apps/opie-console/sz_transfer.h
index aa97c32..0505215 100644
--- a/noncore/apps/opie-console/sz_transfer.h
+++ b/noncore/apps/opie-console/sz_transfer.h
@@ -1,40 +1,40 @@
1#ifndef OPIE_FL_SZ_H 1#ifndef OPIE_FL_SZ_H
2#define OPIE_FL_SZ_H 2#define OPIE_FL_SZ_H
3 3
4#include "file_layer.h" 4#include "file_layer.h"
5#include <opie2/oprocess.h> 5#include <opie2/oprocess.h>
6 6
7class SzTransfer : public FileTransferLayer { 7class SzTransfer : public FileTransferLayer {
8 8
9 Q_OBJECT 9 Q_OBJECT
10 10
11public: 11public:
12 enum Type { 12 enum Type {
13 SZ=0, 13 SZ=0,
14 SX, 14 SX,
15 SY 15 SY
16 }; 16 };
17 17
18 SzTransfer( Type t, IOLayer * ); 18 SzTransfer( Type t, IOLayer * );
19 ~SzTransfer(); 19 ~SzTransfer();
20 20
21public slots: 21public slots:
22 /** 22 /**
23 * send a file over the layer 23 * send a file over the layer
24 */ 24 */
25 void sendFile( const QString& file ) ; 25 void sendFile( const QString& file ) ;
26 void sendFile( const QFile& ); 26 void sendFile( const QFile& );
27 void sent(); 27 void sent();
28 28
29private slots: 29private slots:
30 void SzReceivedStdout(OProcess *, char *, int); 30 void SzReceivedStdout(Opie::Core::OProcess *, char *, int);
31 void SzReceivedStderr(OProcess *, char *, int); 31 void SzReceivedStderr(Opie::Core::OProcess *, char *, int);
32 void receivedStdin(const QByteArray &); 32 void receivedStdin(const QByteArray &);
33 33
34private: 34private:
35 OProcess *proc; 35 Opie::Core::OProcess *proc;
36 Type m_t; 36 Type m_t;
37 37
38}; 38};
39 39
40#endif 40#endif
diff --git a/noncore/apps/opie-console/tabwidget.cpp b/noncore/apps/opie-console/tabwidget.cpp
index 419f8ac..6429e3c 100644
--- a/noncore/apps/opie-console/tabwidget.cpp
+++ b/noncore/apps/opie-console/tabwidget.cpp
@@ -1,44 +1,45 @@
1 1
2#include "tabwidget.h" 2#include "tabwidget.h"
3 3
4using namespace Opie::Ui;
4TabWidget::TabWidget( QWidget* parent, const char* name ) 5TabWidget::TabWidget( QWidget* parent, const char* name )
5 : OTabWidget( parent, name ) { 6 : OTabWidget( parent, name ) {
6 connect(this, SIGNAL( currentChanged(QWidget*) ), 7 connect(this, SIGNAL( currentChanged(QWidget*) ),
7 this, SLOT( slotCurChanged(QWidget*) ) ); 8 this, SLOT( slotCurChanged(QWidget*) ) );
8} 9}
9 10
10TabWidget::~TabWidget() { 11TabWidget::~TabWidget() {
11} 12}
12 13
13void TabWidget::add( Session* ses ) { 14void TabWidget::add( Session* ses ) {
14 qWarning("session ses " + ses->name() ); 15 qWarning("session ses " + ses->name() );
15 if ( !ses->widgetStack() ) return; 16 if ( !ses->widgetStack() ) return;
16 //reparent( ses->widgetStack(), QPoint() ); 17 //reparent( ses->widgetStack(), QPoint() );
17 addTab( ses->widgetStack(), "console/konsole", ses->name() ); 18 addTab( ses->widgetStack(), "console/konsole", ses->name() );
18 //addTab( ses->widgetStack(), ses->name() ); 19 //addTab( ses->widgetStack(), ses->name() );
19 m_map.insert( ses->widgetStack(), ses ); 20 m_map.insert( ses->widgetStack(), ses );
20} 21}
21 22
22void TabWidget::remove( Session* ses ) { 23void TabWidget::remove( Session* ses ) {
23 m_map.remove( ses->widgetStack() ); 24 m_map.remove( ses->widgetStack() );
24 removePage( ses->widgetStack() ); 25 removePage( ses->widgetStack() );
25} 26}
26 27
27void TabWidget::slotCurChanged( QWidget* wid ) { 28void TabWidget::slotCurChanged( QWidget* wid ) {
28 QMap<QWidget*, Session*>::Iterator it; 29 QMap<QWidget*, Session*>::Iterator it;
29 it = m_map.find( wid ); 30 it = m_map.find( wid );
30 if ( it == m_map.end() ) { 31 if ( it == m_map.end() ) {
31 return; 32 return;
32 } 33 }
33 34
34 emit activated( it.data() ); 35 emit activated( it.data() );
35} 36}
36void TabWidget::setCurrent( Session* ses ) { 37void TabWidget::setCurrent( Session* ses ) {
37 if (!ses ) 38 if (!ses )
38 return; 39 return;
39 40
40 //showPage( ses->widgetStack() ); 41 //showPage( ses->widgetStack() );
41 setCurrentTab( ses->widgetStack() ); 42 setCurrentTab( ses->widgetStack() );
42} 43}
43 44
44 45
diff --git a/noncore/apps/opie-console/tabwidget.h b/noncore/apps/opie-console/tabwidget.h
index 98450a3..0138645 100644
--- a/noncore/apps/opie-console/tabwidget.h
+++ b/noncore/apps/opie-console/tabwidget.h
@@ -1,29 +1,29 @@
1#ifndef OPIE_TAB_WIDGET_H 1#ifndef OPIE_TAB_WIDGET_H
2#define OPIE_TAB_WIDGET_H 2#define OPIE_TAB_WIDGET_H
3 3
4#include <qmap.h> 4#include <qmap.h>
5#include <opie2/otabwidget.h> 5#include <opie2/otabwidget.h>
6 6
7#include "session.h" 7#include "session.h"
8/** 8/**
9 * This is our central tab widget 9 * This is our central tab widget
10 * we can add sessions here 10 * we can add sessions here
11 */ 11 */
12class TabWidget : public OTabWidget{ 12class TabWidget : public Opie::Ui::OTabWidget{
13 Q_OBJECT 13 Q_OBJECT
14public: 14public:
15 TabWidget(QWidget *parent, const char* name ); 15 TabWidget(QWidget *parent, const char* name );
16 ~TabWidget(); 16 ~TabWidget();
17 void add( Session* ); 17 void add( Session* );
18 void remove( Session* ); 18 void remove( Session* );
19 void setCurrent( Session* ); 19 void setCurrent( Session* );
20 20
21signals: 21signals:
22 void activated(Session* ses ); 22 void activated(Session* ses );
23private slots: 23private slots:
24 void slotCurChanged( QWidget* wid ); 24 void slotCurChanged( QWidget* wid );
25private: 25private:
26 QMap<QWidget*, Session*> m_map; 26 QMap<QWidget*, Session*> m_map;
27}; 27};
28 28
29#endif 29#endif
diff --git a/noncore/apps/opie-console/test/senderui.cpp b/noncore/apps/opie-console/test/senderui.cpp
index b1725db..df27055 100644
--- a/noncore/apps/opie-console/test/senderui.cpp
+++ b/noncore/apps/opie-console/test/senderui.cpp
@@ -1,77 +1,79 @@
1#include <stdlib.h> 1#include <stdlib.h>
2#include <stdio.h> 2#include <stdio.h>
3#include <fcntl.h> 3#include <fcntl.h>
4#include <sys/termios.h> 4#include <sys/termios.h>
5 5
6#include <qmultilineedit.h> 6#include <qmultilineedit.h>
7#include <qsocketnotifier.h> 7#include <qsocketnotifier.h>
8 8
9#include "../profile.h" 9#include "../profile.h"
10#include "../io_serial.h" 10#include "../io_serial.h"
11#include "../filetransfer.h" 11#include "../filetransfer.h"
12#include "../filereceive.h" 12#include "../filereceive.h"
13 13
14#include <opie2/oprocess.h> 14#include <opie2/oprocess.h>
15 15
16#include "senderui.h" 16#include "senderui.h"
17 17
18using namespace Opie::Core;
19using namespace Opie::Core;
18SenderUI::SenderUI() 20SenderUI::SenderUI()
19 : Sender() { 21 : Sender() {
20 22
21 /* we do that manually */ 23 /* we do that manually */
22 Profile prof; 24 Profile prof;
23 QString str = "/dev/bty0"; 25 QString str = "/dev/bty0";
24 prof.writeEntry("Device",str ); 26 prof.writeEntry("Device",str );
25 prof.writeEntry("Baud", 19200 ); 27 prof.writeEntry("Baud", 19200 );
26 28
27 qWarning("prof " + prof.readEntry("Device") + " " + str); 29 qWarning("prof " + prof.readEntry("Device") + " " + str);
28 ser = new IOSerial(prof); 30 ser = new IOSerial(prof);
29 connect(ser, SIGNAL(received(const QByteArray&) ), 31 connect(ser, SIGNAL(received(const QByteArray&) ),
30 this, SLOT(got(const QByteArray&) ) ); 32 this, SLOT(got(const QByteArray&) ) );
31 33
32 if ( ser->open() ) 34 if ( ser->open() )
33 qWarning("opened!!!"); 35 qWarning("opened!!!");
34 else 36 else
35 qWarning("could not open"); 37 qWarning("could not open");
36 38
37 39
38} 40}
39SenderUI::~SenderUI() { 41SenderUI::~SenderUI() {
40 42
41} 43}
42void SenderUI::slotSendFile() { 44void SenderUI::slotSendFile() {
43 45
44 sz = new FileTransfer(FileTransfer::SY, ser); 46 sz = new FileTransfer(FileTransfer::SY, ser);
45 sz->sendFile("/home/ich/bootopie-v06-13.jffs2"); 47 sz->sendFile("/home/ich/bootopie-v06-13.jffs2");
46 48
47 connect (sz, SIGNAL(sent()), 49 connect (sz, SIGNAL(sent()),
48 this, SLOT(fileTransComplete())); 50 this, SLOT(fileTransComplete()));
49} 51}
50 52
51void SenderUI::slotSend() { 53void SenderUI::slotSend() {
52 QCString str = MultiLineEdit1->text().utf8(); 54 QCString str = MultiLineEdit1->text().utf8();
53 qWarning("sending: %s", str.data() ); 55 qWarning("sending: %s", str.data() );
54 str = str.replace( QRegExp("\n"), "\r"); 56 str = str.replace( QRegExp("\n"), "\r");
55 ser->send( str ); 57 ser->send( str );
56} 58}
57void SenderUI::got(const QByteArray& ar) { 59void SenderUI::got(const QByteArray& ar) {
58 qWarning("got:"); 60 qWarning("got:");
59 for ( uint i = 0; i < ar.count(); i++ ) { 61 for ( uint i = 0; i < ar.count(); i++ ) {
60 printf("%c", ar[i] ); 62 printf("%c", ar[i] );
61 } 63 }
62 printf("\n"); 64 printf("\n");
63} 65}
64 66
65void SenderUI::fileTransComplete() { 67void SenderUI::fileTransComplete() {
66 68
67 qWarning("file transfer complete"); 69 qWarning("file transfer complete");
68} 70}
69void SenderUI::send() { 71void SenderUI::send() {
70 72
71} 73}
72void SenderUI::slotRev(){ 74void SenderUI::slotRev(){
73qWarning("Going to receive!"); 75qWarning("Going to receive!");
74FileReceive *rev = new FileReceive( FileReceive::SZ, ser ); 76FileReceive *rev = new FileReceive( FileReceive::SZ, ser );
75rev->receive(); 77rev->receive();
76 78
77} 79}
diff --git a/noncore/apps/opie-console/test/senderui.h b/noncore/apps/opie-console/test/senderui.h
index c130dcf..15f0743 100644
--- a/noncore/apps/opie-console/test/senderui.h
+++ b/noncore/apps/opie-console/test/senderui.h
@@ -1,34 +1,34 @@
1#ifndef SENDER_UI_H 1#ifndef SENDER_UI_H
2#define SENDER_UI_H 2#define SENDER_UI_H
3 3
4#include <qcstring.h> 4#include <qcstring.h>
5 5
6#include "sender.h" 6#include "sender.h"
7 7
8class IOSerial; 8class IOSerial;
9class FileTransfer; 9class FileTransfer;
10class QSocketNotifier; 10class QSocketNotifier;
11class OProcess; 11namespace Opie {namespace Core {class Opie::Core::OProcess;}}
12class SenderUI : public Sender { 12class SenderUI : public Sender {
13 Q_OBJECT 13 Q_OBJECT
14public: 14public:
15 SenderUI(); 15 SenderUI();
16 ~SenderUI(); 16 ~SenderUI();
17 17
18public slots: 18public slots:
19 void send(); 19 void send();
20 void slotSendFile(); 20 void slotSendFile();
21 void slotSend(); 21 void slotSend();
22 void slotRev(); 22 void slotRev();
23 void got(const QByteArray& ); 23 void got(const QByteArray& );
24 void fileTransComplete(); 24 void fileTransComplete();
25private: 25private:
26 IOSerial* ser; 26 IOSerial* ser;
27 FileTransfer* sz; 27 FileTransfer* sz;
28 int m_fd; 28 int m_fd;
29 QSocketNotifier* m_sock; 29 QSocketNotifier* m_sock;
30 OProcess* m_proc; 30 Opie::Core::OProcess* m_proc;
31}; 31};
32 32
33 33
34#endif 34#endif
diff --git a/noncore/apps/opie-console/transferdialog.cpp b/noncore/apps/opie-console/transferdialog.cpp
index d494a6c..75eb443 100644
--- a/noncore/apps/opie-console/transferdialog.cpp
+++ b/noncore/apps/opie-console/transferdialog.cpp
@@ -1,275 +1,276 @@
1#include <qlayout.h> 1#include <qlayout.h>
2#include <qcombobox.h> 2#include <qcombobox.h>
3#include <qlabel.h> 3#include <qlabel.h>
4#include <qlineedit.h> 4#include <qlineedit.h>
5#include <qpushbutton.h> 5#include <qpushbutton.h>
6#include <qmessagebox.h> 6#include <qmessagebox.h>
7#include <qprogressbar.h> 7#include <qprogressbar.h>
8#include <qradiobutton.h> 8#include <qradiobutton.h>
9#include <qbuttongroup.h> 9#include <qbuttongroup.h>
10 10
11#include <opie2/ofiledialog.h> 11#include <opie2/ofiledialog.h>
12 12
13#include "metafactory.h" 13#include "metafactory.h"
14#include "mainwindow.h" 14#include "mainwindow.h"
15 15
16#include "transferdialog.h" 16#include "transferdialog.h"
17 17
18using namespace Opie::Ui;
18TransferDialog::TransferDialog(QWidget *parent, MainWindow *mainwindow, const char *) 19TransferDialog::TransferDialog(QWidget *parent, MainWindow *mainwindow, const char *)
19: QDialog(parent, 0l, false), m_win(mainwindow) 20: QDialog(parent, 0l, false), m_win(mainwindow)
20{ 21{
21 m_lay = 0l; 22 m_lay = 0l;
22 m_recvlay = 0l; 23 m_recvlay = 0l;
23 QVBoxLayout *vbox, *vbox2; 24 QVBoxLayout *vbox, *vbox2;
24 QHBoxLayout *hbox, *hbox2, *hbox3; 25 QHBoxLayout *hbox, *hbox2, *hbox3;
25 QLabel *file, *mode, *progress, *status; 26 QLabel *file, *mode, *progress, *status;
26 QButtonGroup *group; 27 QButtonGroup *group;
27 QRadioButton *mode_send, *mode_receive; 28 QRadioButton *mode_send, *mode_receive;
28 29
29 m_autocleanup = 0; 30 m_autocleanup = 0;
30 m_running = true; 31 m_running = true;
31 32
32 group = new QButtonGroup(QObject::tr("Transfer mode"), this); 33 group = new QButtonGroup(QObject::tr("Transfer mode"), this);
33 mode_send = new QRadioButton(QObject::tr("Send"), group); 34 mode_send = new QRadioButton(QObject::tr("Send"), group);
34 mode_receive = new QRadioButton(QObject::tr("Receive"), group); 35 mode_receive = new QRadioButton(QObject::tr("Receive"), group);
35 group->insert(mode_send, id_send); 36 group->insert(mode_send, id_send);
36 group->insert(mode_receive, id_receive); 37 group->insert(mode_receive, id_receive);
37 vbox2 = new QVBoxLayout(group, 2); 38 vbox2 = new QVBoxLayout(group, 2);
38 vbox2->addSpacing(10); 39 vbox2->addSpacing(10);
39 hbox3 = new QHBoxLayout(vbox2, 2); 40 hbox3 = new QHBoxLayout(vbox2, 2);
40 hbox3->add(mode_send); 41 hbox3->add(mode_send);
41 hbox3->add(mode_receive); 42 hbox3->add(mode_receive);
42 mode_send->setChecked(true); 43 mode_send->setChecked(true);
43 m_transfermode = id_send; 44 m_transfermode = id_send;
44 45
45 file = new QLabel(QObject::tr("Send file"), this); 46 file = new QLabel(QObject::tr("Send file"), this);
46 mode = new QLabel(QObject::tr("Transfer protocol"), this); 47 mode = new QLabel(QObject::tr("Transfer protocol"), this);
47 progress = new QLabel(QObject::tr("Progress"), this); 48 progress = new QLabel(QObject::tr("Progress"), this);
48 status = new QLabel(QObject::tr("Status"), this); 49 status = new QLabel(QObject::tr("Status"), this);
49 50
50 statusbar = new QLabel(QObject::tr("Ready"), this); 51 statusbar = new QLabel(QObject::tr("Ready"), this);
51 statusbar->setFrameStyle(QFrame::Panel | QFrame::Sunken); 52 statusbar->setFrameStyle(QFrame::Panel | QFrame::Sunken);
52 53
53 protocol = new QComboBox(this); 54 protocol = new QComboBox(this);
54 QStringList list = m_win->factory()->fileTransferLayers(); 55 QStringList list = m_win->factory()->fileTransferLayers();
55 for (QStringList::Iterator it = list.begin(); it != list.end(); ++it) 56 for (QStringList::Iterator it = list.begin(); it != list.end(); ++it)
56 protocol->insertItem((*it)); 57 protocol->insertItem((*it));
57 58
58 filename = new QLineEdit(this); 59 filename = new QLineEdit(this);
59 60
60 progressbar = new QProgressBar(this); 61 progressbar = new QProgressBar(this);
61 progressbar->setProgress(0); 62 progressbar->setProgress(0);
62 63
63 selector = new QPushButton("...", this); 64 selector = new QPushButton("...", this);
64 ok = new QPushButton(QObject::tr("Start transfer"), this); 65 ok = new QPushButton(QObject::tr("Start transfer"), this);
65 cancel = new QPushButton(QObject::tr("Cancel"), this); 66 cancel = new QPushButton(QObject::tr("Cancel"), this);
66 67
67 vbox = new QVBoxLayout(this, 2); 68 vbox = new QVBoxLayout(this, 2);
68 vbox->add(group); 69 vbox->add(group);
69 vbox->add(file); 70 vbox->add(file);
70 hbox = new QHBoxLayout(vbox, 0); 71 hbox = new QHBoxLayout(vbox, 0);
71 hbox->add(filename); 72 hbox->add(filename);
72 hbox->add(selector); 73 hbox->add(selector);
73 vbox->add(mode); 74 vbox->add(mode);
74 vbox->add(protocol); 75 vbox->add(protocol);
75 vbox->add(progress); 76 vbox->add(progress);
76 vbox->add(progressbar); 77 vbox->add(progressbar);
77 vbox->add(status); 78 vbox->add(status);
78 vbox->add(statusbar); 79 vbox->add(statusbar);
79 vbox->addStretch(1); 80 vbox->addStretch(1);
80 hbox2 = new QHBoxLayout(vbox, 2); 81 hbox2 = new QHBoxLayout(vbox, 2);
81 hbox2->add(ok); 82 hbox2->add(ok);
82 hbox2->add(cancel); 83 hbox2->add(cancel);
83 84
84 setCaption(QObject::tr("File transfer")); 85 setCaption(QObject::tr("File transfer"));
85 show(); 86 show();
86 87
87 connect(selector, SIGNAL(clicked()), SLOT(slotFilename())); 88 connect(selector, SIGNAL(clicked()), SLOT(slotFilename()));
88 connect(ok, SIGNAL(clicked()), SLOT(slotTransfer())); 89 connect(ok, SIGNAL(clicked()), SLOT(slotTransfer()));
89 connect(cancel, SIGNAL(clicked()), SLOT(slotCancel())); 90 connect(cancel, SIGNAL(clicked()), SLOT(slotCancel()));
90 connect(group, SIGNAL(clicked(int)), SLOT(slotMode(int))); 91 connect(group, SIGNAL(clicked(int)), SLOT(slotMode(int)));
91} 92}
92 93
93TransferDialog::~TransferDialog() 94TransferDialog::~TransferDialog()
94{ 95{
95} 96}
96 97
97void TransferDialog::slotFilename() 98void TransferDialog::slotFilename()
98{ 99{
99 QString f; 100 QString f;
100 101
101 f = Opie::OFileDialog::getOpenFileName(0); 102 f = OFileDialog::getOpenFileName(0);
102 if(!f.isNull()) filename->setText(f); 103 if(!f.isNull()) filename->setText(f);
103} 104}
104 105
105void TransferDialog::slotTransfer() 106void TransferDialog::slotTransfer()
106{ 107{
107 if((m_transfermode == id_send) && (filename->text().isEmpty())) 108 if((m_transfermode == id_send) && (filename->text().isEmpty()))
108 { 109 {
109 QMessageBox::information(this, 110 QMessageBox::information(this,
110 QObject::tr("Attention"), 111 QObject::tr("Attention"),
111 QObject::tr("No file has been specified.")); 112 QObject::tr("No file has been specified."));
112 return; 113 return;
113 } 114 }
114 115
115 ok->setEnabled(false); 116 ok->setEnabled(false);
116 117
117 cleanup(); 118 cleanup();
118 m_autocleanup = 0; 119 m_autocleanup = 0;
119 120
120 if(m_transfermode == id_send) statusbar->setText(QObject::tr("Sending...")); 121 if(m_transfermode == id_send) statusbar->setText(QObject::tr("Sending..."));
121 else statusbar->setText(QObject::tr("Receiving...")); 122 else statusbar->setText(QObject::tr("Receiving..."));
122 123
123 if(m_transfermode == id_send) 124 if(m_transfermode == id_send)
124 { 125 {
125 m_lay = m_win->factory()->newFileTransfer(protocol->currentText(), m_win->currentSession()->layer()); 126 m_lay = m_win->factory()->newFileTransfer(protocol->currentText(), m_win->currentSession()->layer());
126 m_lay->sendFile(filename->text()); 127 m_lay->sendFile(filename->text());
127 128
128 connect(m_lay, SIGNAL(progress(const QString&,int,int,int,int,int)), 129 connect(m_lay, SIGNAL(progress(const QString&,int,int,int,int,int)),
129 SLOT(slotProgress(const QString&,int,int,int,int,int))); 130 SLOT(slotProgress(const QString&,int,int,int,int,int)));
130 connect(m_lay, SIGNAL(error(int,const QString&)), SLOT(slotError(int,const QString&))); 131 connect(m_lay, SIGNAL(error(int,const QString&)), SLOT(slotError(int,const QString&)));
131 connect(m_lay, SIGNAL(sent()), SLOT(slotSent())); 132 connect(m_lay, SIGNAL(sent()), SLOT(slotSent()));
132 } 133 }
133 else 134 else
134 { 135 {
135 m_recvlay = m_win->factory()->newReceive(protocol->currentText(), m_win->currentSession()->layer()); 136 m_recvlay = m_win->factory()->newReceive(protocol->currentText(), m_win->currentSession()->layer());
136 m_recvlay->receive(); 137 m_recvlay->receive();
137 138
138 connect(m_recvlay, SIGNAL(progress(const QString&,int,int,int,int,int)), 139 connect(m_recvlay, SIGNAL(progress(const QString&,int,int,int,int,int)),
139 SLOT(slotProgress(const QString&,int,int,int,int,int))); 140 SLOT(slotProgress(const QString&,int,int,int,int,int)));
140 connect(m_recvlay, SIGNAL(error(int,const QString&)), SLOT(slotError(int,const QString&))); 141 connect(m_recvlay, SIGNAL(error(int,const QString&)), SLOT(slotError(int,const QString&)));
141 connect(m_recvlay, SIGNAL(received(const QString&)), SLOT(slotReceived(const QString&))); 142 connect(m_recvlay, SIGNAL(received(const QString&)), SLOT(slotReceived(const QString&)));
142 } 143 }
143} 144}
144 145
145void TransferDialog::cleanup() 146void TransferDialog::cleanup()
146{ 147{
147 if(m_lay) 148 if(m_lay)
148 { 149 {
149 m_lay->cancel(); 150 m_lay->cancel();
150 delete m_lay; 151 delete m_lay;
151 m_lay = 0l; 152 m_lay = 0l;
152 } 153 }
153 if(m_recvlay) 154 if(m_recvlay)
154 { 155 {
155 m_recvlay->cancel(); 156 m_recvlay->cancel();
156 delete m_recvlay; 157 delete m_recvlay;
157 m_recvlay = 0l; 158 m_recvlay = 0l;
158 } 159 }
159} 160}
160 161
161void TransferDialog::slotCancel() 162void TransferDialog::slotCancel()
162{ 163{
163 ok->setEnabled(true); 164 ok->setEnabled(true);
164 statusbar->setText(QObject::tr("Ready")); 165 statusbar->setText(QObject::tr("Ready"));
165 166
166 if((m_lay) || (m_recvlay)) 167 if((m_lay) || (m_recvlay))
167 { 168 {
168 cleanup(); 169 cleanup();
169 if(m_autocleanup) 170 if(m_autocleanup)
170 { 171 {
171 m_running = false; 172 m_running = false;
172 close(); 173 close();
173 } 174 }
174 else 175 else
175 { 176 {
176 QMessageBox::information(this, 177 QMessageBox::information(this,
177 QObject::tr("Cancelled"), 178 QObject::tr("Cancelled"),
178 QObject::tr("The file transfer has been cancelled.")); 179 QObject::tr("The file transfer has been cancelled."));
179 } 180 }
180 } 181 }
181 else 182 else
182 { 183 {
183 m_running = false; 184 m_running = false;
184 close(); 185 close();
185 } 186 }
186} 187}
187 188
188void TransferDialog::slotProgress(const QString& , int progress, int , int , int, int ) 189void TransferDialog::slotProgress(const QString& , int progress, int , int , int, int )
189{ 190{
190 progressbar->setProgress(progress); 191 progressbar->setProgress(progress);
191} 192}
192 193
193void TransferDialog::slotError(int error, const QString& ) 194void TransferDialog::slotError(int error, const QString& )
194{ 195{
195 statusbar->setText(QObject::tr("Ready")); 196 statusbar->setText(QObject::tr("Ready"));
196 197
197 switch(error) 198 switch(error)
198 { 199 {
199 case FileTransferLayer::NotSupported: 200 case FileTransferLayer::NotSupported:
200 QMessageBox::critical(this, 201 QMessageBox::critical(this,
201 QObject::tr("Error"), 202 QObject::tr("Error"),
202 QObject::tr("Operation not supported.")); 203 QObject::tr("Operation not supported."));
203 break; 204 break;
204 case FileTransferLayer::StartError: 205 case FileTransferLayer::StartError:
205 QMessageBox::critical(this, 206 QMessageBox::critical(this,
206 QObject::tr("Error"), 207 QObject::tr("Error"),
207 QObject::tr("Transfer could not be started.")); 208 QObject::tr("Transfer could not be started."));
208 break; 209 break;
209 case FileTransferLayer::NoError: 210 case FileTransferLayer::NoError:
210 QMessageBox::critical(this, 211 QMessageBox::critical(this,
211 QObject::tr("Error"), 212 QObject::tr("Error"),
212 QObject::tr("No error.")); 213 QObject::tr("No error."));
213 break; 214 break;
214 case FileTransferLayer::Undefined: 215 case FileTransferLayer::Undefined:
215 QMessageBox::critical(this, 216 QMessageBox::critical(this,
216 QObject::tr("Error"), 217 QObject::tr("Error"),
217 QObject::tr("Undefined error occured.")); 218 QObject::tr("Undefined error occured."));
218 break; 219 break;
219 case FileTransferLayer::Incomplete: 220 case FileTransferLayer::Incomplete:
220 QMessageBox::critical(this, 221 QMessageBox::critical(this,
221 QObject::tr("Error"), 222 QObject::tr("Error"),
222 QObject::tr("Incomplete transfer.")); 223 QObject::tr("Incomplete transfer."));
223 break; 224 break;
224 case FileTransferLayer::Unknown: 225 case FileTransferLayer::Unknown:
225 default: 226 default:
226 QMessageBox::critical(this, 227 QMessageBox::critical(this,
227 QObject::tr("Error"), 228 QObject::tr("Error"),
228 QObject::tr("Unknown error occured.")); 229 QObject::tr("Unknown error occured."));
229 break; 230 break;
230 } 231 }
231 232
232 m_autocleanup = 1; 233 m_autocleanup = 1;
233} 234}
234 235
235void TransferDialog::slotSent() 236void TransferDialog::slotSent()
236{ 237{
237 progressbar->setProgress(100); 238 progressbar->setProgress(100);
238 QMessageBox::information(this, QObject::tr("Sent"), QObject::tr("File has been sent.")); 239 QMessageBox::information(this, QObject::tr("Sent"), QObject::tr("File has been sent."));
239 ok->setEnabled(true); 240 ok->setEnabled(true);
240 progressbar->setProgress(0); 241 progressbar->setProgress(0);
241 statusbar->setText(QObject::tr("Ready")); 242 statusbar->setText(QObject::tr("Ready"));
242 m_autocleanup = 1; 243 m_autocleanup = 1;
243} 244}
244 245
245void TransferDialog::slotReceived(const QString& ) 246void TransferDialog::slotReceived(const QString& )
246{ 247{
247 progressbar->setProgress(100); 248 progressbar->setProgress(100);
248 QMessageBox::information(this, QObject::tr("Received"), QObject::tr("File has been received.")); 249 QMessageBox::information(this, QObject::tr("Received"), QObject::tr("File has been received."));
249 //QMessageBox::information(this, QObject::tr("Sent"), QObject::tr("File has been received as %1.").arg(file)); 250 //QMessageBox::information(this, QObject::tr("Sent"), QObject::tr("File has been received as %1.").arg(file));
250 ok->setEnabled(true); 251 ok->setEnabled(true);
251 progressbar->setProgress(0); 252 progressbar->setProgress(0);
252 statusbar->setText(QObject::tr("Ready")); 253 statusbar->setText(QObject::tr("Ready"));
253 m_autocleanup = 1; 254 m_autocleanup = 1;
254} 255}
255 256
256void TransferDialog::slotMode(int id) 257void TransferDialog::slotMode(int id)
257{ 258{
258 if(id == id_send) 259 if(id == id_send)
259 { 260 {
260 selector->setEnabled(true); 261 selector->setEnabled(true);
261 filename->setEnabled(true); 262 filename->setEnabled(true);
262 } 263 }
263 else 264 else
264 { 265 {
265 selector->setEnabled(false); 266 selector->setEnabled(false);
266 filename->setEnabled(false); 267 filename->setEnabled(false);
267 } 268 }
268 m_transfermode = id; 269 m_transfermode = id;
269} 270}
270 271
271bool TransferDialog::isRunning() 272bool TransferDialog::isRunning()
272{ 273{
273 return m_running; 274 return m_running;
274} 275}
275 276
diff --git a/noncore/apps/opie-reader/QTReaderApp.cpp b/noncore/apps/opie-reader/QTReaderApp.cpp
index b0d589e..b072854 100644
--- a/noncore/apps/opie-reader/QTReaderApp.cpp
+++ b/noncore/apps/opie-reader/QTReaderApp.cpp
@@ -1,218 +1,218 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. Allrights reserved. 2** Copyright (C) 2000 Trolltech AS. Allrights reserved.
3** 3**
4** This file is part of Qt Palmtop Environment. 4** This file is part of Qt Palmtop Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include "useqpe.h" 20#include "useqpe.h"
21#include <qregexp.h> 21#include <qregexp.h>
22#include <qclipboard.h> 22#include <qclipboard.h>
23#include <qwidgetstack.h> 23#include <qwidgetstack.h>
24#ifdef USEQPE 24#ifdef USEQPE
25#include <qmenubar.h> 25#include <qmenubar.h>
26#include <qpe/qpetoolbar.h> 26#include <qtoolbar.h>
27#endif 27#endif
28#include <qmenubar.h> 28#include <qmenubar.h>
29#include <qtoolbar.h> 29#include <qtoolbar.h>
30#ifdef USEQPE 30#ifdef USEQPE
31#include <qpe/menubutton.h> 31#include <qpe/menubutton.h>
32#include <qpe/fontdatabase.h> 32#include <qpe/fontdatabase.h>
33#endif 33#endif
34#include <qcombobox.h> 34#include <qcombobox.h>
35#include <qpopupmenu.h> 35#include <qpopupmenu.h>
36#include <qaction.h> 36#include <qaction.h>
37#include <qapplication.h> 37#include <qapplication.h>
38#include <qlineedit.h> 38#include <qlineedit.h>
39#include <qtoolbutton.h> 39#include <qtoolbutton.h>
40#include <qspinbox.h> 40#include <qspinbox.h>
41#include <qobjectlist.h> 41#include <qobjectlist.h>
42#ifdef USEQPE 42#ifdef USEQPE
43#include <qpe/global.h> 43#include <qpe/global.h>
44#include <qpe/applnk.h> 44#include <qpe/applnk.h>
45#endif 45#endif
46#include <qfileinfo.h> 46#include <qfileinfo.h>
47#include <stdlib.h> //getenv 47#include <stdlib.h> //getenv
48#include <qprogressbar.h> 48#include <qprogressbar.h>
49#ifdef USEQPE 49#ifdef USEQPE
50#include <qpe/config.h> 50#include <qpe/config.h>
51#endif 51#endif
52#include <qbuttongroup.h> 52#include <qbuttongroup.h>
53#include <qradiobutton.h> 53#include <qradiobutton.h>
54#ifdef USEQPE 54#ifdef USEQPE
55#include <qpe/qcopenvelope_qws.h> 55#include <qpe/qcopenvelope_qws.h>
56#endif 56#endif
57#include "QTReader.h" 57#include "QTReader.h"
58#include "GraphicWin.h" 58#include "GraphicWin.h"
59#include "Bkmks.h" 59#include "Bkmks.h"
60#include "cbkmkselector.h" 60#include "cbkmkselector.h"
61#include "infowin.h" 61#include "infowin.h"
62#include "ToolbarPrefs.h" 62#include "ToolbarPrefs.h"
63#include "Prefs.h" 63#include "Prefs.h"
64#include "CAnnoEdit.h" 64#include "CAnnoEdit.h"
65#include "QFloatBar.h" 65#include "QFloatBar.h"
66#include "FixedFont.h" 66#include "FixedFont.h"
67#include "URLDialog.h" 67#include "URLDialog.h"
68//#include <qpe/fontdatabase.h> 68//#include <qpe/fontdatabase.h>
69 69
70#ifdef USEQPE 70#ifdef USEQPE
71#include <qpe/resource.h> 71#include <qpe/resource.h>
72#include <qpe/qpeapplication.h> 72#include <qpe/qpeapplication.h>
73#include "fileBrowser.h" 73#include "fileBrowser.h"
74#else 74#else
75#include "qfiledialog.h" 75#include "qfiledialog.h"
76#endif 76#endif
77 77
78#include "QTReaderApp.h" 78#include "QTReaderApp.h"
79#include "CDrawBuffer.h" 79#include "CDrawBuffer.h"
80#include "Filedata.h" 80#include "Filedata.h"
81#include "opie.h" 81#include "opie.h"
82#include "names.h" 82#include "names.h"
83#include "CEncoding_tables.h" 83#include "CEncoding_tables.h"
84#include "CloseDialog.h" 84#include "CloseDialog.h"
85 85
86bool CheckVersion(int&, int&, char&); 86bool CheckVersion(int&, int&, char&);
87 87
88#ifdef _WINDOWS 88#ifdef _WINDOWS
89#define PICDIR "c:\\uqtreader\\pics\\" 89#define PICDIR "c:\\uqtreader\\pics\\"
90#else 90#else
91#ifdef USEQPE 91#ifdef USEQPE
92#define PICDIR "opie-reader/" 92#define PICDIR "opie-reader/"
93#else 93#else
94#define PICDIR "/home/tim/uqtreader/pics/" 94#define PICDIR "/home/tim/uqtreader/pics/"
95#endif 95#endif
96#endif 96#endif
97 97
98unsigned long QTReaderApp::m_uid = 0; 98unsigned long QTReaderApp::m_uid = 0;
99 99
100void QTReaderApp::setScrollState(bool _b) { m_scrollButton->setOn(_b); } 100void QTReaderApp::setScrollState(bool _b) { m_scrollButton->setOn(_b); }
101 101
102#ifdef USEQPE 102#ifdef USEQPE
103#define geticon(iconname) Resource::loadPixmap( iconname ) 103#define geticon(iconname) Resource::loadPixmap( iconname )
104#define getmyicon(iconname) Resource::loadPixmap( PICDIR iconname ) 104#define getmyicon(iconname) Resource::loadPixmap( PICDIR iconname )
105#else 105#else
106#define geticon(iconname) QPixmap(PICDIR iconname ".png") 106#define geticon(iconname) QPixmap(PICDIR iconname ".png")
107#define getmyicon(iconname) geticon(iconname) 107#define getmyicon(iconname) geticon(iconname)
108//#define geticon(iconname) QIconSet( QPixmap(PICDIR iconname) ) 108//#define geticon(iconname) QIconSet( QPixmap(PICDIR iconname) )
109#endif 109#endif
110 110
111#ifndef _WINDOWS 111#ifndef _WINDOWS
112#include <unistd.h> 112#include <unistd.h>
113#endif 113#endif
114#include <stddef.h> 114#include <stddef.h>
115#ifndef _WINDOWS 115#ifndef _WINDOWS
116#include <dirent.h> 116#include <dirent.h>
117#endif 117#endif
118 118
119void QTReaderApp::listBkmkFiles() 119void QTReaderApp::listBkmkFiles()
120{ 120{
121 bkmkselector->clear(); 121 bkmkselector->clear();
122 bkmkselector->setText("Cancel"); 122 bkmkselector->setText("Cancel");
123#ifndef USEQPE 123#ifndef USEQPE
124 int cnt = 0; 124 int cnt = 0;
125 125
126 QDir d = QDir::home(); // "/" 126 QDir d = QDir::home(); // "/"
127 if ( !d.cd(APPDIR) ) { // "/tmp" 127 if ( !d.cd(APPDIR) ) { // "/tmp"
128 qWarning( "Cannot find the \"~/" APPDIR "\" directory" ); 128 qWarning( "Cannot find the \"~/" APPDIR "\" directory" );
129 d = QDir::home(); 129 d = QDir::home();
130 d.mkdir(APPDIR); 130 d.mkdir(APPDIR);
131 d.cd(APPDIR); 131 d.cd(APPDIR);
132 } 132 }
133 133
134 134
135 135
136 136
137 d.setFilter( QDir::Files | QDir::NoSymLinks ); 137 d.setFilter( QDir::Files | QDir::NoSymLinks );
138// d.setSorting( QDir::Size | QDir::Reversed ); 138// d.setSorting( QDir::Size | QDir::Reversed );
139 139
140 const QFileInfoList *list = d.entryInfoList(); 140 const QFileInfoList *list = d.entryInfoList();
141 QFileInfoListIterator it( *list ); // create list iterator 141 QFileInfoListIterator it( *list ); // create list iterator
142 QFileInfo *fi; // pointer for traversing 142 QFileInfo *fi; // pointer for traversing
143 143
144 while ( (fi=it.current()) ) { // for each file... 144 while ( (fi=it.current()) ) { // for each file...
145 145
146 bkmkselector->insertItem(fi->fileName()); 146 bkmkselector->insertItem(fi->fileName());
147 cnt++; 147 cnt++;
148 148
149 //qDebug( "%10li %s", fi->size(), fi->fileName().data() ); 149 //qDebug( "%10li %s", fi->size(), fi->fileName().data() );
150 ++it; // goto next list element 150 ++it; // goto next list element
151 } 151 }
152 152
153#else /* USEQPE */ 153#else /* USEQPE */
154 int cnt = 0; 154 int cnt = 0;
155 DIR *d; 155 DIR *d;
156 d = opendir((const char *)Global::applicationFileName(APPDIR,"")); 156 d = opendir((const char *)Global::applicationFileName(APPDIR,""));
157 157
158 while(1) 158 while(1)
159 { 159 {
160 struct dirent* de; 160 struct dirent* de;
161 struct stat buf; 161 struct stat buf;
162 de = readdir(d); 162 de = readdir(d);
163 if (de == NULL) break; 163 if (de == NULL) break;
164 164
165 if (lstat((const char *)Global::applicationFileName(APPDIR,de->d_name),&buf) == 0 && S_ISREG(buf.st_mode)) 165 if (lstat((const char *)Global::applicationFileName(APPDIR,de->d_name),&buf) == 0 && S_ISREG(buf.st_mode))
166 { 166 {
167 bkmkselector->insertItem(de->d_name); 167 bkmkselector->insertItem(de->d_name);
168 cnt++; 168 cnt++;
169 } 169 }
170 } 170 }
171 171
172 closedir(d); 172 closedir(d);
173#endif 173#endif
174 if (cnt > 0) 174 if (cnt > 0)
175 { 175 {
176//tjw menu->hide(); 176//tjw menu->hide();
177 editorStack->raiseWidget( bkmkselector ); 177 editorStack->raiseWidget( bkmkselector );
178 hidetoolbars(); 178 hidetoolbars();
179 m_nBkmkAction = cRmBkmkFile; 179 m_nBkmkAction = cRmBkmkFile;
180 } 180 }
181 else 181 else
182 QMessageBox::information(this, PROGNAME, "No bookmark files"); 182 QMessageBox::information(this, PROGNAME, "No bookmark files");
183} 183}
184 184
185void QTReaderApp::hidetoolbars() 185void QTReaderApp::hidetoolbars()
186{ 186{
187 menubar->hide(); 187 menubar->hide();
188 if (fileBar != NULL) fileBar->hide(); 188 if (fileBar != NULL) fileBar->hide();
189 if (viewBar != NULL) viewBar->hide(); 189 if (viewBar != NULL) viewBar->hide();
190 if (navBar != NULL) navBar->hide(); 190 if (navBar != NULL) navBar->hide();
191 if (markBar != NULL) markBar->hide(); 191 if (markBar != NULL) markBar->hide();
192 if (m_fontVisible) m_fontBar->hide(); 192 if (m_fontVisible) m_fontBar->hide();
193 if (regVisible) 193 if (regVisible)
194 { 194 {
195#ifdef USEQPE 195#ifdef USEQPE
196 Global::hideInputMethod(); 196 Global::hideInputMethod();
197#endif 197#endif
198 regBar->hide(); 198 regBar->hide();
199 } 199 }
200 if (searchVisible) 200 if (searchVisible)
201 { 201 {
202#ifdef USEQPE 202#ifdef USEQPE
203 Global::hideInputMethod(); 203 Global::hideInputMethod();
204#endif 204#endif
205 searchBar->hide(); 205 searchBar->hide();
206 } 206 }
207} 207}
208 208
209QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) 209QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
210 : QMainWindow( parent, name, f ), bFromDocView( FALSE ), m_dontSave(false), 210 : QMainWindow( parent, name, f ), bFromDocView( FALSE ), m_dontSave(false),
211 fileBar(NULL), navBar(NULL), viewBar(NULL), markBar(NULL) 211 fileBar(NULL), navBar(NULL), viewBar(NULL), markBar(NULL)
212{ 212{
213 m_url_clipboard = false; 213 m_url_clipboard = false;
214 m_url_localfile = false; 214 m_url_localfile = false;
215 m_url_globalfile = false; 215 m_url_globalfile = false;
216 ftime(&m_lastkeytime); 216 ftime(&m_lastkeytime);
217//// qDebug("Application directory = %s", (const tchar *)QPEApplication::documentDir()); 217//// qDebug("Application directory = %s", (const tchar *)QPEApplication::documentDir());
218//// qDebug("Application directory = %s", (const tchar *)Global::applicationFileName("uqtreader","bkmks.xml")); 218//// qDebug("Application directory = %s", (const tchar *)Global::applicationFileName("uqtreader","bkmks.xml"));
diff --git a/noncore/apps/opie-sheet/main.cpp b/noncore/apps/opie-sheet/main.cpp
index c7a7d88..861473e 100644
--- a/noncore/apps/opie-sheet/main.cpp
+++ b/noncore/apps/opie-sheet/main.cpp
@@ -1,20 +1,23 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * This program is free software; you can redistribute it and/or modify * 3 * This program is free software; you can redistribute it and/or modify *
4 * it under the terms of the GNU General Public License as published by * 4 * it under the terms of the GNU General Public License as published by *
5 * the Free Software Foundation; either version 2 of the License, or * 5 * the Free Software Foundation; either version 2 of the License, or *
6 * (at your option) any later version. * 6 * (at your option) any later version. *
7 * * 7 * *
8 ***************************************************************************/ 8 ***************************************************************************/
9 9
10/* 10/*
11 * Opie Sheet (formerly Sheet/Qt) 11 * Opie Sheet (formerly Sheet/Qt)
12 * by Serdar Ozler <sozler@sitebest.com> 12 * by Serdar Ozler <sozler@sitebest.com>
13 */ 13 */
14 14
15
15#include "mainwindow.h" 16#include "mainwindow.h"
16 17
17#include <opie2/oapplicationfactory.h> 18#include <opie2/oapplicationfactory.h>
18 19
20using namespace Opie::Core;
21
19OPIE_EXPORT_APP( OApplicationFactory<MainWindow> ) 22OPIE_EXPORT_APP( OApplicationFactory<MainWindow> )
20 23
diff --git a/noncore/apps/opie-write/main.cpp b/noncore/apps/opie-write/main.cpp
index 6a8aaaa..036fe48 100644
--- a/noncore/apps/opie-write/main.cpp
+++ b/noncore/apps/opie-write/main.cpp
@@ -1,28 +1,30 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
6** Licensees holding valid Qtopia Developer license may use this 6** Licensees holding valid Qtopia Developer license may use this
7** file in accordance with the Qtopia Developer License Agreement 7** file in accordance with the Qtopia Developer License Agreement
8** provided with the Software. 8** provided with the Software.
9** 9**
10** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING 10** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING
11** THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR 11** THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
12** PURPOSE. 12** PURPOSE.
13** 13**
14** email sales@trolltech.com for information about Qtopia License 14** email sales@trolltech.com for information about Qtopia License
15** Agreements. 15** Agreements.
16** 16**
17** Contact info@trolltech.com if any conditions of this licensing are 17** Contact info@trolltech.com if any conditions of this licensing are
18** not clear to you. 18** not clear to you.
19** 19**
20**********************************************************************/ 20**********************************************************************/
21 21
22
22#include "mainwindow.h" 23#include "mainwindow.h"
23 24
24#include <opie2/oapplicationfactory.h> 25#include <opie2/oapplicationfactory.h>
25 26
27using namespace Opie::Core;
26OPIE_EXPORT_APP( OApplicationFactory<MainWindow> ) 28OPIE_EXPORT_APP( OApplicationFactory<MainWindow> )
27 29
28 30
diff --git a/noncore/apps/oxygen/main.cpp b/noncore/apps/oxygen/main.cpp
index 276b90d..e2a602b 100644
--- a/noncore/apps/oxygen/main.cpp
+++ b/noncore/apps/oxygen/main.cpp
@@ -1,23 +1,25 @@
1/*************************************************************************** 1/***************************************************************************
2 application: : Oxygen 2 application: : Oxygen
3 3
4 begin : September 2002 4 begin : September 2002
5 copyright : ( C ) 2002 by Carsten Niehaus 5 copyright : ( C ) 2002 by Carsten Niehaus
6 email : cniehaus@handhelds.org 6 email : cniehaus@handhelds.org
7 **************************************************************************/ 7 **************************************************************************/
8 8
9/*************************************************************************** 9/***************************************************************************
10 * * 10 * *
11 * This program is free software; you can redistribute it and/or modify * 11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by * 12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or * 13 * the Free Software Foundation; either version 2 of the License, or *
14 * ( at your option ) any later version. * 14 * ( at your option ) any later version. *
15 * * 15 * *
16 **************************************************************************/ 16 **************************************************************************/
17 17
18#include <opie2/oapplicationfactory.h> 18#include <opie2/oapplicationfactory.h>
19 19
20#include "oxygen.h" 20#include "oxygen.h"
21 21
22 22
23using namespace Opie::Core;
24using namespace Opie::Core;
23OPIE_EXPORT_APP( OApplicationFactory<Oxygen> ) 25OPIE_EXPORT_APP( OApplicationFactory<Oxygen> )
diff --git a/noncore/apps/tableviewer/main.cpp b/noncore/apps/tableviewer/main.cpp
index 80a76e0..7ef281c 100644
--- a/noncore/apps/tableviewer/main.cpp
+++ b/noncore/apps/tableviewer/main.cpp
@@ -1,25 +1,27 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include "tableviewer.h" 20#include "tableviewer.h"
21 21
22#include <opie2/oapplicationfactory.h> 22#include <opie2/oapplicationfactory.h>
23 23
24using namespace Opie::Core;
24OPIE_EXPORT_APP( OApplicationFactory<TableViewerWindow> ) 25OPIE_EXPORT_APP( OApplicationFactory<TableViewerWindow> )
26using namespace Opie::Core;
25 27
diff --git a/noncore/apps/tableviewer/tableviewer.cpp b/noncore/apps/tableviewer/tableviewer.cpp
index 4c6d809..102b94c 100644
--- a/noncore/apps/tableviewer/tableviewer.cpp
+++ b/noncore/apps/tableviewer/tableviewer.cpp
@@ -1,225 +1,225 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21/* local includes */ 21/* local includes */
22#include "tableviewer.h" 22#include "tableviewer.h"
23#include "ui/tvbrowseview.h" 23#include "ui/tvbrowseview.h"
24#include "ui/tvfilterview.h" 24#include "ui/tvfilterview.h"
25#include "ui/tvlistview.h" 25#include "ui/tvlistview.h"
26#include "ui/tveditview.h" 26#include "ui/tveditview.h"
27#include "ui/tvkeyedit.h" 27#include "ui/tvkeyedit.h"
28#include "db/datacache.h" 28#include "db/datacache.h"
29 29
30/* QPE includes */ 30/* QPE includes */
31#include <qpe/fileselector.h> 31#include <qpe/fileselector.h>
32#include <qpe/resource.h> 32#include <qpe/resource.h>
33#include <qpe/qpetoolbar.h> 33#include <qtoolbar.h>
34 34
35/* QTE includes */ 35/* QTE includes */
36#include <qmenubar.h> 36#include <qmenubar.h>
37#include <qpopupmenu.h> 37#include <qpopupmenu.h>
38#include <qapplication.h> 38#include <qapplication.h>
39#include <qwidgetstack.h> 39#include <qwidgetstack.h>
40#include <qlayout.h> 40#include <qlayout.h>
41#include <qbuffer.h> 41#include <qbuffer.h>
42/*! 42/*!
43 \class TableViewerWindow 43 \class TableViewerWindow
44 \brief The main window widget of the application 44 \brief The main window widget of the application
45 45
46 This is the main widget of the table viewer application. 46 This is the main widget of the table viewer application.
47 It is the co-ordination point. 47 It is the co-ordination point.
48*/ 48*/
49 49
50/*! 50/*!
51 Constructs a new TableViewerWindow 51 Constructs a new TableViewerWindow
52*/ 52*/
53TableViewerWindow::TableViewerWindow(QWidget *parent, const char *name, WFlags f) 53TableViewerWindow::TableViewerWindow(QWidget *parent, const char *name, WFlags f)
54 : QMainWindow(parent, name, f) 54 : QMainWindow(parent, name, f)
55{ 55{
56 setCaption(tr("Table Viewer")); 56 setCaption(tr("Table Viewer"));
57 57
58/* Build data */ 58/* Build data */
59 ds = new DBStore(); 59 ds = new DBStore();
60 doc.setType("text/x-xml-tableviewer"); 60 doc.setType("text/x-xml-tableviewer");
61 doc.setName("table"); 61 doc.setName("table");
62 62
63 dirty = FALSE; 63 dirty = FALSE;
64 ts.current_column = 0; 64 ts.current_column = 0;
65 ts.kRep = ds->getKeys(); 65 ts.kRep = ds->getKeys();
66 66
67/* build menus */ 67/* build menus */
68 menu = new QMenuBar(this, 0); 68 menu = new QMenuBar(this, 0);
69 69
70 QPopupMenu *file_menu = new QPopupMenu; 70 QPopupMenu *file_menu = new QPopupMenu;
71 file_menu->insertItem("New", this, SLOT(newDocument())); 71 file_menu->insertItem("New", this, SLOT(newDocument()));
72 72
73 file_menu->insertItem("Open", this, SLOT(selectDocument())); 73 file_menu->insertItem("Open", this, SLOT(selectDocument()));
74 file_menu->insertSeparator(); 74 file_menu->insertSeparator();
75 file_menu->insertItem("Properties"); 75 file_menu->insertItem("Properties");
76 76
77 /* later will want to set this up to clean up first via this, SLOT(quit) */ 77 /* later will want to set this up to clean up first via this, SLOT(quit) */
78 menu->insertItem("Document", file_menu); 78 menu->insertItem("Document", file_menu);
79 79
80 QPopupMenu *edit_menu = new QPopupMenu; 80 QPopupMenu *edit_menu = new QPopupMenu;
81 edit_menu->insertItem("Edit Item", this, SLOT(editItemSlot())); 81 edit_menu->insertItem("Edit Item", this, SLOT(editItemSlot()));
82 edit_menu->insertItem("Edit Keys", this, SLOT(editKeysSlot())); 82 edit_menu->insertItem("Edit Keys", this, SLOT(editKeysSlot()));
83 edit_menu->insertItem("Edit filters", this, SLOT(filterViewSlot())); 83 edit_menu->insertItem("Edit filters", this, SLOT(filterViewSlot()));
84 menu->insertItem("Edit", edit_menu); 84 menu->insertItem("Edit", edit_menu);
85 85
86 QPopupMenu *view_menu = new QPopupMenu; 86 QPopupMenu *view_menu = new QPopupMenu;
87 view_menu->insertItem("Browse View", this, SLOT(browseViewSlot())); 87 view_menu->insertItem("Browse View", this, SLOT(browseViewSlot()));
88 view_menu->insertItem("List View", this, SLOT(listViewSlot())); 88 view_menu->insertItem("List View", this, SLOT(listViewSlot()));
89 menu->insertItem("View", view_menu); 89 menu->insertItem("View", view_menu);
90 90
91 QVBoxLayout *main_layout = new QVBoxLayout; 91 QVBoxLayout *main_layout = new QVBoxLayout;
92 92
93 /* Build tool bar */ 93 /* Build tool bar */
94 navigation = new QToolBar(this, "navigation"); 94 navigation = new QToolBar(this, "navigation");
95 QToolButton *newItemButton = new QToolButton( 95 QToolButton *newItemButton = new QToolButton(
96 QIconSet(Resource::loadPixmap("new")), "New Item", QString::null, 96 QIconSet(Resource::loadPixmap("new")), "New Item", QString::null,
97 this, SLOT(newItemSlot()), navigation, "New Item"); 97 this, SLOT(newItemSlot()), navigation, "New Item");
98 QToolButton *editItemButton = new QToolButton( 98 QToolButton *editItemButton = new QToolButton(
99 QIconSet(Resource::loadPixmap("edit")), "Edit Item", QString::null, 99 QIconSet(Resource::loadPixmap("edit")), "Edit Item", QString::null,
100 this, SLOT(editItemSlot()), navigation, "Edit Item"); 100 this, SLOT(editItemSlot()), navigation, "Edit Item");
101 QToolButton *deleteItemButton = new QToolButton( 101 QToolButton *deleteItemButton = new QToolButton(
102 QIconSet(Resource::loadPixmap("trash")), "Delete Item", 102 QIconSet(Resource::loadPixmap("trash")), "Delete Item",
103 QString::null, this, 103 QString::null, this,
104 SLOT(deleteItemSlot()), navigation, "Delete Item"); 104 SLOT(deleteItemSlot()), navigation, "Delete Item");
105 105
106 navigation->addSeparator(); 106 navigation->addSeparator();
107 107
108 QToolButton *firstItemButton = new QToolButton( 108 QToolButton *firstItemButton = new QToolButton(
109 QIconSet(Resource::loadPixmap("fastback")), "First Item", 109 QIconSet(Resource::loadPixmap("fastback")), "First Item",
110 QString::null, this, 110 QString::null, this,
111 SLOT(firstItem()), navigation, "First Item"); 111 SLOT(firstItem()), navigation, "First Item");
112 QToolButton *previousItemButton = new QToolButton( 112 QToolButton *previousItemButton = new QToolButton(
113 QIconSet(Resource::loadPixmap("back")), "Previous Item", 113 QIconSet(Resource::loadPixmap("back")), "Previous Item",
114 QString::null, this, 114 QString::null, this,
115 SLOT(previousItem()), navigation, "Previous Item"); 115 SLOT(previousItem()), navigation, "Previous Item");
116 QToolButton *nextItemButton = new QToolButton( 116 QToolButton *nextItemButton = new QToolButton(
117 QIconSet(Resource::loadPixmap("forward")), "Next Item", 117 QIconSet(Resource::loadPixmap("forward")), "Next Item",
118 QString::null, this, 118 QString::null, this,
119 SLOT(nextItem()), navigation, "Next Item"); 119 SLOT(nextItem()), navigation, "Next Item");
120 QToolButton *lastItemButton = new QToolButton( 120 QToolButton *lastItemButton = new QToolButton(
121 QIconSet(Resource::loadPixmap("fastforward")), "Last Item", 121 QIconSet(Resource::loadPixmap("fastforward")), "Last Item",
122 QString::null, this, 122 QString::null, this,
123 SLOT(lastItem()), navigation, "Last Item"); 123 SLOT(lastItem()), navigation, "Last Item");
124 124
125 navigation->addSeparator(); 125 navigation->addSeparator();
126 QToolButton *browseButton = new QToolButton( 126 QToolButton *browseButton = new QToolButton(
127 QIconSet(Resource::loadPixmap("day")), "View Single Item", 127 QIconSet(Resource::loadPixmap("day")), "View Single Item",
128 QString::null, this, 128 QString::null, this,
129 SLOT(browseViewSlot()), navigation, "View Single Item"); 129 SLOT(browseViewSlot()), navigation, "View Single Item");
130 QToolButton *listButton = new QToolButton( 130 QToolButton *listButton = new QToolButton(
131 QIconSet(Resource::loadPixmap("month")), "View Multiple Items", 131 QIconSet(Resource::loadPixmap("month")), "View Multiple Items",
132 QString::null, this, 132 QString::null, this,
133 SLOT(listViewSlot()), navigation, "View Multiple Items"); 133 SLOT(listViewSlot()), navigation, "View Multiple Items");
134 134
135 setToolBarsMovable(FALSE); 135 setToolBarsMovable(FALSE);
136 setToolBarsMovable(FALSE); 136 setToolBarsMovable(FALSE);
137 setToolBarsMovable(FALSE); 137 setToolBarsMovable(FALSE);
138 138
139/* Build widgets */ 139/* Build widgets */
140 browseView = new TVBrowseView(&ts, this, 0); 140 browseView = new TVBrowseView(&ts, this, 0);
141 listView = new TVListView(&ts, this, 0); 141 listView = new TVListView(&ts, this, 0);
142 filterView = new TVFilterView(&ts, this, 0); 142 filterView = new TVFilterView(&ts, this, 0);
143 fileSelector = new FileSelector("text/csv;text/x-xml-tableviewer", 143 fileSelector = new FileSelector("text/csv;text/x-xml-tableviewer",
144 this, "fileselector"); 144 this, "fileselector");
145 fileSelector->setNewVisible(FALSE); 145 fileSelector->setNewVisible(FALSE);
146 fileSelector->setCloseVisible(FALSE); 146 fileSelector->setCloseVisible(FALSE);
147 147
148 cw = new QWidgetStack(this, 0); 148 cw = new QWidgetStack(this, 0);
149 cw->addWidget(listView, ListState); 149 cw->addWidget(listView, ListState);
150 cw->addWidget(browseView, BrowseState); 150 cw->addWidget(browseView, BrowseState);
151 cw->addWidget(filterView, FilterState); 151 cw->addWidget(filterView, FilterState);
152 cw->addWidget(fileSelector, FileState); 152 cw->addWidget(fileSelector, FileState);
153 153
154 current_view = FileState; 154 current_view = FileState;
155 cw->raiseWidget(current_view); 155 cw->raiseWidget(current_view);
156 fileSelector->reread(); 156 fileSelector->reread();
157 157
158 connect(browseView, SIGNAL(searchOnKey(int,TVVariant)), 158 connect(browseView, SIGNAL(searchOnKey(int,TVVariant)),
159 this, SLOT(searchOnKey(int,TVVariant))); 159 this, SLOT(searchOnKey(int,TVVariant)));
160 connect(browseView, SIGNAL(sortChanged(int)), 160 connect(browseView, SIGNAL(sortChanged(int)),
161 this, SLOT(setPrimaryKey(int))); 161 this, SLOT(setPrimaryKey(int)));
162 162
163 connect(fileSelector, SIGNAL(closeMe()), this, SLOT(browseViewSlot())); 163 connect(fileSelector, SIGNAL(closeMe()), this, SLOT(browseViewSlot()));
164 connect(fileSelector, SIGNAL(fileSelected(const DocLnk&)), 164 connect(fileSelector, SIGNAL(fileSelected(const DocLnk&)),
165 this, SLOT(openDocument(const DocLnk&))); 165 this, SLOT(openDocument(const DocLnk&)));
166 166
167 main_layout->addWidget(menu); 167 main_layout->addWidget(menu);
168 main_layout->addWidget(cw); 168 main_layout->addWidget(cw);
169 169
170 setCentralWidget(cw); 170 setCentralWidget(cw);
171 171
172} 172}
173 173
174/*! 174/*!
175 Destroys the TableViewerWindow 175 Destroys the TableViewerWindow
176*/ 176*/
177TableViewerWindow::~TableViewerWindow() 177TableViewerWindow::~TableViewerWindow()
178{ 178{
179 if(dirty) 179 if(dirty)
180 saveDocument(); 180 saveDocument();
181} 181}
182 182
183/*! 183/*!
184 Opens a file dialog and loads the file specified by the dialog 184 Opens a file dialog and loads the file specified by the dialog
185*/ 185*/
186void TableViewerWindow::selectDocument() 186void TableViewerWindow::selectDocument()
187{ 187{
188 if(dirty) 188 if(dirty)
189 saveDocument(); 189 saveDocument();
190 current_view = FileState; 190 current_view = FileState;
191 cw->raiseWidget(current_view); 191 cw->raiseWidget(current_view);
192 fileSelector->reread(); 192 fileSelector->reread();
193} 193}
194 194
195void TableViewerWindow::saveDocument() 195void TableViewerWindow::saveDocument()
196{ 196{
197 if(!dirty) 197 if(!dirty)
198 return; 198 return;
199 199
200 FileManager fm; 200 FileManager fm;
201 QIODevice *dev = fm.saveFile(doc); 201 QIODevice *dev = fm.saveFile(doc);
202 202
203 if(!ds->saveSource(dev, doc.type())){ 203 if(!ds->saveSource(dev, doc.type())){
204 qWarning("Save unsuccessful"); 204 qWarning("Save unsuccessful");
205 return; 205 return;
206 } 206 }
207 dev->close(); 207 dev->close();
208 dirty = FALSE; 208 dirty = FALSE;
209} 209}
210 210
211void TableViewerWindow::newDocument() 211void TableViewerWindow::newDocument()
212{ 212{
213 DocLnk nf; 213 DocLnk nf;
214 nf.setType("text/x-xml-tableviewer"); 214 nf.setType("text/x-xml-tableviewer");
215 nf.setName("table"); 215 nf.setName("table");
216 216
217 delete ds; 217 delete ds;
218 ds = new DBStore(); 218 ds = new DBStore();
219 219
220 ts.current_column = 0; 220 ts.current_column = 0;
221 ts.kRep = ds->getKeys(); 221 ts.kRep = ds->getKeys();
222 browseView->reset(); 222 browseView->reset();
223 listView->reset(); 223 listView->reset();
224 filterView->reset(); 224 filterView->reset();
225 225
diff --git a/noncore/apps/tinykate/libkate/view/kateviewdialog.cpp b/noncore/apps/tinykate/libkate/view/kateviewdialog.cpp
index 8e68262..c3a0a2e 100644
--- a/noncore/apps/tinykate/libkate/view/kateviewdialog.cpp
+++ b/noncore/apps/tinykate/libkate/view/kateviewdialog.cpp
@@ -1,241 +1,243 @@
1/*************************************************************************** 1/***************************************************************************
2 kateviewdialog.cpp - description 2 kateviewdialog.cpp - description
3 ------------------- 3 -------------------
4 copyright : (C) 2001 by The Kate Team 4 copyright : (C) 2001 by The Kate Team
5 (C) 2002 by Joseph Wenninger 5 (C) 2002 by Joseph Wenninger
6 email : kwrite-devel@kde.org 6 email : kwrite-devel@kde.org
7 jowenn@kde.org 7 jowenn@kde.org
8 8
9 ***************************************************************************/ 9 ***************************************************************************/
10 10
11/*************************************************************************** 11/***************************************************************************
12 * * 12 * *
13 * This program is free software; you can redistribute it and/or modify * 13 * This program is free software; you can redistribute it and/or modify *
14 * it under the terms of the GNU General Public License as published by * 14 * it under the terms of the GNU General Public License as published by *
15 * the Free Software Foundation; either version 2 of the License, or * 15 * the Free Software Foundation; either version 2 of the License, or *
16 * (at your option) any later version. * 16 * (at your option) any later version. *
17 * * 17 * *
18 ***************************************************************************/ 18 ***************************************************************************/
19// Dialogs 19// Dialogs
20 20
21#include <stdio.h> 21#include <stdio.h>
22#include <stdlib.h> 22#include <stdlib.h>
23 23
24#include <qgrid.h> 24#include <qgrid.h>
25#include <qlabel.h> 25#include <qlabel.h>
26#include <qlayout.h> 26#include <qlayout.h>
27#include <qlistbox.h> 27#include <qlistbox.h>
28#include <qgroupbox.h> 28#include <qgroupbox.h>
29#include <qlineedit.h> 29#include <qlineedit.h>
30#include <qcheckbox.h> 30#include <qcheckbox.h>
31#include <qcollection.h> 31#include <qcollection.h>
32#include <qpushbutton.h> 32#include <qpushbutton.h>
33#include <qobjectlist.h> 33#include <qobjectlist.h>
34#include <qradiobutton.h> 34#include <qradiobutton.h>
35#include <qwhatsthis.h> 35#include <qwhatsthis.h>
36#include <qstringlist.h> 36#include <qstringlist.h>
37#include <klocale.h> 37#include <klocale.h>
38#include <kcolorbtn.h> 38#include <kcolorbtn.h>
39#include <kglobal.h> 39#include <kglobal.h>
40#include <qvbox.h> 40#include <qvbox.h>
41#include <qspinbox.h> 41#include <qspinbox.h>
42#include <qcombobox.h> 42#include <qcombobox.h>
43#include <kfontdialog.h> 43#include <kfontdialog.h>
44 44
45#include "../document/katedocument.h" 45#include "../document/katedocument.h"
46#include "kateviewdialog.h" 46#include "kateviewdialog.h"
47#include <opie2/ofontselector.h> 47#include <opie2/ofontselector.h>
48 48
49 49
50using namespace Opie::Ui;
51using namespace Opie::Ui;
50SearchDialog::SearchDialog( QWidget *parent, QStringList &searchFor, QStringList &replaceWith, int flags ) 52SearchDialog::SearchDialog( QWidget *parent, QStringList &searchFor, QStringList &replaceWith, int flags )
51 : KDialogBase( parent, 0L, true, i18n( "Find Text" ), Ok | Cancel, Ok ) 53 : KDialogBase( parent, 0L, true, i18n( "Find Text" ), Ok | Cancel, Ok )
52 , m_replace( 0L ) 54 , m_replace( 0L )
53{ 55{
54 QWidget *page = new QWidget( this ); 56 QWidget *page = new QWidget( this );
55 setMainWidget( page ); 57 setMainWidget( page );
56 58
57 QVBoxLayout *topLayout = new QVBoxLayout( page, 0, spacingHint() ); 59 QVBoxLayout *topLayout = new QVBoxLayout( page, 0, spacingHint() );
58 60
59 m_search = new QComboBox( true, page ); 61 m_search = new QComboBox( true, page );
60 m_search->insertStringList( searchFor ); 62 m_search->insertStringList( searchFor );
61 m_search->setMinimumWidth( m_search->sizeHint().width() ); 63 m_search->setMinimumWidth( m_search->sizeHint().width() );
62 m_search->lineEdit()->selectAll(); 64 m_search->lineEdit()->selectAll();
63 QLabel *label = new QLabel( m_search, i18n( "&Text To Find:" ), page ); 65 QLabel *label = new QLabel( m_search, i18n( "&Text To Find:" ), page );
64 m_optRegExp = new QCheckBox( i18n( "Regular Expression" ), page ); 66 m_optRegExp = new QCheckBox( i18n( "Regular Expression" ), page );
65 topLayout->addWidget( label ); 67 topLayout->addWidget( label );
66 topLayout->addWidget( m_search ); 68 topLayout->addWidget( m_search );
67 topLayout->addWidget( m_optRegExp ); 69 topLayout->addWidget( m_optRegExp );
68 70
69 if( flags & KateView::sfReplace ) 71 if( flags & KateView::sfReplace )
70 { 72 {
71 // make it a replace dialog 73 // make it a replace dialog
72 setCaption( i18n( "Replace Text" ) ); 74 setCaption( i18n( "Replace Text" ) );
73 m_replace = new QComboBox( true, page ); 75 m_replace = new QComboBox( true, page );
74 m_replace->insertStringList( replaceWith ); 76 m_replace->insertStringList( replaceWith );
75 m_replace->setMinimumWidth( m_search->sizeHint().width() ); 77 m_replace->setMinimumWidth( m_search->sizeHint().width() );
76 label = new QLabel( m_replace, i18n( "&Replace With:" ), page ); 78 label = new QLabel( m_replace, i18n( "&Replace With:" ), page );
77 //m_optPlaceholders = new QCheckBox( i18n( "&Use Placeholders" ), page ); 79 //m_optPlaceholders = new QCheckBox( i18n( "&Use Placeholders" ), page );
78 topLayout->addWidget( label ); 80 topLayout->addWidget( label );
79 topLayout->addWidget( m_replace ); 81 topLayout->addWidget( m_replace );
80 //topLayout->addWidget( m_optPlaceholders ); 82 //topLayout->addWidget( m_optPlaceholders );
81 } 83 }
82 84
83 QGroupBox *group = new QGroupBox( i18n( "Options" ), page ); 85 QGroupBox *group = new QGroupBox( i18n( "Options" ), page );
84 topLayout->addWidget( group, 10 ); 86 topLayout->addWidget( group, 10 );
85 87
86 QGridLayout *gbox = new QGridLayout( group, 5, 2, spacingHint() ); 88 QGridLayout *gbox = new QGridLayout( group, 5, 2, spacingHint() );
87 gbox->addRowSpacing( 0, fontMetrics().lineSpacing() ); 89 gbox->addRowSpacing( 0, fontMetrics().lineSpacing() );
88 gbox->setRowStretch( 4, 10 ); 90 gbox->setRowStretch( 4, 10 );
89 91
90 m_opt1 = new QCheckBox( i18n( "C&ase Sensitive" ), group ); 92 m_opt1 = new QCheckBox( i18n( "C&ase Sensitive" ), group );
91 gbox->addWidget( m_opt1, 1, 0 ); 93 gbox->addWidget( m_opt1, 1, 0 );
92 94
93 m_opt2 = new QCheckBox(i18n("&Whole Words Only" ), group ); 95 m_opt2 = new QCheckBox(i18n("&Whole Words Only" ), group );
94 gbox->addWidget( m_opt2, 2, 0 ); 96 gbox->addWidget( m_opt2, 2, 0 );
95 97
96 m_opt3 = new QCheckBox(i18n("&From Beginning" ), group ); 98 m_opt3 = new QCheckBox(i18n("&From Beginning" ), group );
97 gbox->addWidget( m_opt3, 3, 0 ); 99 gbox->addWidget( m_opt3, 3, 0 );
98 100
99 m_opt4 = new QCheckBox(i18n("Find &Backwards" ), group ); 101 m_opt4 = new QCheckBox(i18n("Find &Backwards" ), group );
100 gbox->addWidget( m_opt4, 1, 1 ); 102 gbox->addWidget( m_opt4, 1, 1 );
101 103
102 m_opt5 = new QCheckBox(i18n("&Selected Text" ), group ); 104 m_opt5 = new QCheckBox(i18n("&Selected Text" ), group );
103 gbox->addWidget( m_opt5, 2, 1 ); 105 gbox->addWidget( m_opt5, 2, 1 );
104 106
105 m_opt1->setChecked( flags & KateView::sfCaseSensitive ); 107 m_opt1->setChecked( flags & KateView::sfCaseSensitive );
106 m_opt2->setChecked( flags & KateView::sfWholeWords ); 108 m_opt2->setChecked( flags & KateView::sfWholeWords );
107 m_opt3->setChecked( flags & KateView::sfFromBeginning ); 109 m_opt3->setChecked( flags & KateView::sfFromBeginning );
108 m_optRegExp->setChecked( flags & KateView::sfRegularExpression ); 110 m_optRegExp->setChecked( flags & KateView::sfRegularExpression );
109 m_opt4->setChecked( flags & KateView::sfBackward ); 111 m_opt4->setChecked( flags & KateView::sfBackward );
110 m_opt5->setChecked( flags & KateView::sfSelected ); 112 m_opt5->setChecked( flags & KateView::sfSelected );
111 113
112 if( m_replace ) 114 if( m_replace )
113 { 115 {
114 m_opt6 = new QCheckBox( i18n( "&Prompt On Replace" ), group ); 116 m_opt6 = new QCheckBox( i18n( "&Prompt On Replace" ), group );
115 m_opt6->setChecked( flags & KateView::sfPrompt ); 117 m_opt6->setChecked( flags & KateView::sfPrompt );
116 gbox->addWidget( m_opt6, 3, 1 ); 118 gbox->addWidget( m_opt6, 3, 1 );
117 } 119 }
118 120
119 m_search->setFocus(); 121 m_search->setFocus();
120} 122}
121 123
122QString SearchDialog::getSearchFor() 124QString SearchDialog::getSearchFor()
123{ 125{
124 return m_search->currentText(); 126 return m_search->currentText();
125} 127}
126 128
127QString SearchDialog::getReplaceWith() 129QString SearchDialog::getReplaceWith()
128{ 130{
129 return m_replace->currentText(); 131 return m_replace->currentText();
130} 132}
131 133
132int SearchDialog::getFlags() 134int SearchDialog::getFlags()
133{ 135{
134 int flags = 0; 136 int flags = 0;
135 137
136 if( m_opt1->isChecked() ) flags |= KateView::sfCaseSensitive; 138 if( m_opt1->isChecked() ) flags |= KateView::sfCaseSensitive;
137 if( m_opt2->isChecked() ) flags |= KateView::sfWholeWords; 139 if( m_opt2->isChecked() ) flags |= KateView::sfWholeWords;
138 if( m_opt3->isChecked() ) flags |= KateView::sfFromBeginning; 140 if( m_opt3->isChecked() ) flags |= KateView::sfFromBeginning;
139 if( m_opt4->isChecked() ) flags |= KateView::sfBackward; 141 if( m_opt4->isChecked() ) flags |= KateView::sfBackward;
140 if( m_opt5->isChecked() ) flags |= KateView::sfSelected; 142 if( m_opt5->isChecked() ) flags |= KateView::sfSelected;
141 if( m_optRegExp->isChecked() ) flags |= KateView::sfRegularExpression; 143 if( m_optRegExp->isChecked() ) flags |= KateView::sfRegularExpression;
142 if( m_replace ) 144 if( m_replace )
143 { 145 {
144 if( m_opt6->isChecked() ) 146 if( m_opt6->isChecked() )
145 flags |= KateView::sfPrompt; 147 flags |= KateView::sfPrompt;
146 148
147 flags |= KateView::sfReplace; 149 flags |= KateView::sfReplace;
148 } 150 }
149 151
150 return flags; 152 return flags;
151} 153}
152 154
153void SearchDialog::slotOk() 155void SearchDialog::slotOk()
154{ 156{
155 if ( !m_search->currentText().isEmpty() ) 157 if ( !m_search->currentText().isEmpty() )
156 { 158 {
157 if ( !m_optRegExp->isChecked() ) 159 if ( !m_optRegExp->isChecked() )
158 { 160 {
159 accept(); 161 accept();
160 } 162 }
161 else 163 else
162 { 164 {
163 // Check for a valid regular expression. 165 // Check for a valid regular expression.
164 166
165 QRegExp regExp( m_search->currentText() ); 167 QRegExp regExp( m_search->currentText() );
166 168
167 if ( regExp.isValid() ) 169 if ( regExp.isValid() )
168 accept(); 170 accept();
169 } 171 }
170 } 172 }
171} 173}
172 174
173void SearchDialog::setSearchText( const QString &searchstr ) 175void SearchDialog::setSearchText( const QString &searchstr )
174 { 176 {
175 m_search->insertItem( searchstr, 0 ); 177 m_search->insertItem( searchstr, 0 );
176 m_search->setCurrentItem( 0 ); 178 m_search->setCurrentItem( 0 );
177 m_search->lineEdit()->selectAll(); 179 m_search->lineEdit()->selectAll();
178 } 180 }
179 181
180// this dialog is not modal 182// this dialog is not modal
181ReplacePrompt::ReplacePrompt( QWidget *parent ) 183ReplacePrompt::ReplacePrompt( QWidget *parent )
182 : KDialogBase(parent, 0L, false, i18n( "Replace Text" ), 184 : KDialogBase(parent, 0L, false, i18n( "Replace Text" ),
183 User3 | User2 | User1 | Close, User3, true, 185 User3 | User2 | User1 | Close, User3, true,
184 i18n("&All"), i18n("&No"), i18n("&Yes")) { 186 i18n("&All"), i18n("&No"), i18n("&Yes")) {
185 187
186 QWidget *page = new QWidget(this); 188 QWidget *page = new QWidget(this);
187 setMainWidget(page); 189 setMainWidget(page);
188 190
189 QBoxLayout *topLayout = new QVBoxLayout( page, 0, spacingHint() ); 191 QBoxLayout *topLayout = new QVBoxLayout( page, 0, spacingHint() );
190 QLabel *label = new QLabel(i18n("Replace this occurence?"),page); 192 QLabel *label = new QLabel(i18n("Replace this occurence?"),page);
191 topLayout->addWidget(label ); 193 topLayout->addWidget(label );
192} 194}
193 195
194void ReplacePrompt::slotUser1( void ) { // All 196void ReplacePrompt::slotUser1( void ) { // All
195 done(KateView::srAll); 197 done(KateView::srAll);
196} 198}
197 199
198void ReplacePrompt::slotUser2( void ) { // No 200void ReplacePrompt::slotUser2( void ) { // No
199 done(KateView::srNo); 201 done(KateView::srNo);
200} 202}
201 203
202void ReplacePrompt::slotUser3( void ) { // Yes 204void ReplacePrompt::slotUser3( void ) { // Yes
203 accept(); 205 accept();
204} 206}
205 207
206void ReplacePrompt::done(int r) { 208void ReplacePrompt::done(int r) {
207 setResult(r); 209 setResult(r);
208 emit clicked(); 210 emit clicked();
209} 211}
210 212
211void ReplacePrompt::closeEvent(QCloseEvent *) { 213void ReplacePrompt::closeEvent(QCloseEvent *) {
212 reject(); 214 reject();
213} 215}
214 216
215GotoLineDialog::GotoLineDialog(QWidget *parent, int line, int max) 217GotoLineDialog::GotoLineDialog(QWidget *parent, int line, int max)
216 : KDialogBase(parent, 0L, true, i18n("Goto Line"), Ok | Cancel, Ok) { 218 : KDialogBase(parent, 0L, true, i18n("Goto Line"), Ok | Cancel, Ok) {
217 219
218 QWidget *page = new QWidget(this); 220 QWidget *page = new QWidget(this);
219 setMainWidget(page); 221 setMainWidget(page);
220 222
221 QVBoxLayout *topLayout = new QVBoxLayout( page, 0, spacingHint() ); 223 QVBoxLayout *topLayout = new QVBoxLayout( page, 0, spacingHint() );
222 e1 = new QSpinBox(page); 224 e1 = new QSpinBox(page);
223 e1->setMinValue(1); 225 e1->setMinValue(1);
224 e1->setMaxValue(max); 226 e1->setMaxValue(max);
225 e1->setValue((int)line); 227 e1->setValue((int)line);
226 228
227 QLabel *label = new QLabel( e1,i18n("&Goto Line:"), page ); 229 QLabel *label = new QLabel( e1,i18n("&Goto Line:"), page );
228 topLayout->addWidget(label); 230 topLayout->addWidget(label);
229 topLayout->addWidget(e1); 231 topLayout->addWidget(e1);
230 topLayout->addSpacing(spacingHint()); // A little bit extra space 232 topLayout->addSpacing(spacingHint()); // A little bit extra space
231 topLayout->addStretch(10); 233 topLayout->addStretch(10);
232 e1->setFocus(); 234 e1->setFocus();
233} 235}
234 236
235int GotoLineDialog::getLine() { 237int GotoLineDialog::getLine() {
236 return e1->value(); 238 return e1->value();
237} 239}
238 240
239const int IndentConfigTab::flags[] = {KateView::cfAutoIndent, KateView::cfSpaceIndent, 241const int IndentConfigTab::flags[] = {KateView::cfAutoIndent, KateView::cfSpaceIndent,
240 KateView::cfBackspaceIndents,KateView::cfTabIndents, KateView::cfKeepIndentProfile, KateView::cfKeepExtraSpaces}; 242 KateView::cfBackspaceIndents,KateView::cfTabIndents, KateView::cfKeepIndentProfile, KateView::cfKeepExtraSpaces};
241 243
diff --git a/noncore/apps/tinykate/libkate/view/kateviewdialog.h b/noncore/apps/tinykate/libkate/view/kateviewdialog.h
index 98d8799..d081152 100644
--- a/noncore/apps/tinykate/libkate/view/kateviewdialog.h
+++ b/noncore/apps/tinykate/libkate/view/kateviewdialog.h
@@ -1,196 +1,196 @@
1/*************************************************************************** 1/***************************************************************************
2 kateviewdialog.h - description 2 kateviewdialog.h - description
3 ------------------- 3 -------------------
4 copyright : (C) 2001 by The Kate Team 4 copyright : (C) 2001 by The Kate Team
5 (C) 2002 by Joseph Wenninger 5 (C) 2002 by Joseph Wenninger
6 email : kwrite-devel@kde.org 6 email : kwrite-devel@kde.org
7 jowenn@kde.org 7 jowenn@kde.org
8 8
9 ***************************************************************************/ 9 ***************************************************************************/
10 10
11/*************************************************************************** 11/***************************************************************************
12 * * 12 * *
13 * This program is free software; you can redistribute it and/or modify * 13 * This program is free software; you can redistribute it and/or modify *
14 * it under the terms of the GNU General Public License as published by * 14 * it under the terms of the GNU General Public License as published by *
15 * the Free Software Foundation; either version 2 of the License, or * 15 * the Free Software Foundation; either version 2 of the License, or *
16 * (at your option) any later version. * 16 * (at your option) any later version. *
17 * * 17 * *
18 ***************************************************************************/ 18 ***************************************************************************/
19// Dialogs 19// Dialogs
20 20
21#ifndef _KWDIALOG_H_ 21#ifndef _KWDIALOG_H_
22#define _KWDIALOG_H_ 22#define _KWDIALOG_H_
23 23
24 24
25class QCheckBox; 25class QCheckBox;
26class QLineEdit; 26class QLineEdit;
27class QPushButton; 27class QPushButton;
28class QRadioButton; 28class QRadioButton;
29class QSpinBox; 29class QSpinBox;
30class KColorButton; 30class KColorButton;
31class QComboBox; 31class QComboBox;
32 32
33#include <kdialogbase.h> 33#include <kdialogbase.h>
34#include <opie2/ofontselector.h> 34#include <opie2/ofontselector.h>
35#include "kateview.h" 35#include "kateview.h"
36 36
37class SearchDialog : public KDialogBase 37class SearchDialog : public KDialogBase
38{ 38{
39 Q_OBJECT 39 Q_OBJECT
40 40
41 public: 41 public:
42 SearchDialog( QWidget *parent, QStringList &searchFor, QStringList &replaceWith, int flags ); 42 SearchDialog( QWidget *parent, QStringList &searchFor, QStringList &replaceWith, int flags );
43 QString getSearchFor(); 43 QString getSearchFor();
44 QString getReplaceWith(); 44 QString getReplaceWith();
45 int getFlags(); 45 int getFlags();
46 void setSearchText( const QString &searchstr ); 46 void setSearchText( const QString &searchstr );
47 47
48 protected slots: 48 protected slots:
49 void slotOk(); 49 void slotOk();
50 50
51 protected: 51 protected:
52 QComboBox *m_search; 52 QComboBox *m_search;
53 QComboBox *m_replace; 53 QComboBox *m_replace;
54 QCheckBox *m_opt1; 54 QCheckBox *m_opt1;
55 QCheckBox *m_opt2; 55 QCheckBox *m_opt2;
56 QCheckBox *m_opt3; 56 QCheckBox *m_opt3;
57 QCheckBox *m_optRegExp; 57 QCheckBox *m_optRegExp;
58 QCheckBox *m_opt4; 58 QCheckBox *m_opt4;
59 QCheckBox *m_opt5; 59 QCheckBox *m_opt5;
60 QCheckBox *m_opt6; 60 QCheckBox *m_opt6;
61}; 61};
62 62
63class ReplacePrompt : public KDialogBase 63class ReplacePrompt : public KDialogBase
64{ 64{
65 Q_OBJECT 65 Q_OBJECT
66 66
67 public: 67 public:
68 68
69 ReplacePrompt(QWidget *parent); 69 ReplacePrompt(QWidget *parent);
70 70
71 signals: 71 signals:
72 72
73 void clicked(); 73 void clicked();
74 74
75 protected slots: 75 protected slots:
76 76
77 void slotUser1( void ); // All 77 void slotUser1( void ); // All
78 void slotUser2( void ); // No 78 void slotUser2( void ); // No
79 void slotUser3( void ); // Yes 79 void slotUser3( void ); // Yes
80 virtual void done(int); 80 virtual void done(int);
81 81
82 protected: 82 protected:
83 83
84 void closeEvent(QCloseEvent *); 84 void closeEvent(QCloseEvent *);
85}; 85};
86 86
87class GotoLineDialog : public KDialogBase 87class GotoLineDialog : public KDialogBase
88{ 88{
89 Q_OBJECT 89 Q_OBJECT
90 90
91 public: 91 public:
92 92
93 GotoLineDialog(QWidget *parent, int line, int max); 93 GotoLineDialog(QWidget *parent, int line, int max);
94 int getLine(); 94 int getLine();
95 95
96 protected: 96 protected:
97 97
98 QSpinBox *e1; 98 QSpinBox *e1;
99 QPushButton *btnOK; 99 QPushButton *btnOK;
100}; 100};
101 101
102class IndentConfigTab : public QWidget 102class IndentConfigTab : public QWidget
103{ 103{
104 Q_OBJECT 104 Q_OBJECT
105 105
106 public: 106 public:
107 107
108 IndentConfigTab(QWidget *parent, KateView *); 108 IndentConfigTab(QWidget *parent, KateView *);
109 void getData(KateView *); 109 void getData(KateView *);
110 110
111 protected: 111 protected:
112 112
113 static const int numFlags = 6; 113 static const int numFlags = 6;
114 static const int flags[numFlags]; 114 static const int flags[numFlags];
115 QCheckBox *opt[numFlags]; 115 QCheckBox *opt[numFlags];
116}; 116};
117 117
118class SelectConfigTab : public QWidget 118class SelectConfigTab : public QWidget
119{ 119{
120 Q_OBJECT 120 Q_OBJECT
121 121
122 public: 122 public:
123 123
124 SelectConfigTab(QWidget *parent, KateView *); 124 SelectConfigTab(QWidget *parent, KateView *);
125 void getData(KateView *); 125 void getData(KateView *);
126 126
127 protected: 127 protected:
128 128
129 static const int numFlags = 6; 129 static const int numFlags = 6;
130 static const int flags[numFlags]; 130 static const int flags[numFlags];
131 QCheckBox *opt[numFlags]; 131 QCheckBox *opt[numFlags];
132}; 132};
133 133
134class EditConfigTab : public QWidget 134class EditConfigTab : public QWidget
135{ 135{
136 Q_OBJECT 136 Q_OBJECT
137 137
138 public: 138 public:
139 139
140 EditConfigTab(QWidget *parent, KateView *); 140 EditConfigTab(QWidget *parent, KateView *);
141 void getData(KateView *); 141 void getData(KateView *);
142 142
143 protected: 143 protected:
144 144
145 static const int numFlags = 9; 145 static const int numFlags = 9;
146 static const int flags[numFlags]; 146 static const int flags[numFlags];
147 QCheckBox *opt[numFlags]; 147 QCheckBox *opt[numFlags];
148 QComboBox *encoding; 148 QComboBox *encoding;
149 149
150 150
151 QSpinBox *e1; 151 QSpinBox *e1;
152 QSpinBox *e2; 152 QSpinBox *e2;
153 QSpinBox *e3; 153 QSpinBox *e3;
154}; 154};
155 155
156class ColorConfig : public QWidget 156class ColorConfig : public QWidget
157{ 157{
158 Q_OBJECT 158 Q_OBJECT
159 159
160public: 160public:
161 161
162 ColorConfig( QWidget *parent = 0, char *name = 0 ); 162 ColorConfig( QWidget *parent = 0, char *name = 0 );
163 ~ColorConfig(); 163 ~ColorConfig();
164 164
165 void setColors( QColor * ); 165 void setColors( QColor * );
166 void getColors( QColor * ); 166 void getColors( QColor * );
167 167
168private: 168private:
169 169
170 KColorButton *m_back; 170 KColorButton *m_back;
171 KColorButton *m_selected; 171 KColorButton *m_selected;
172}; 172};
173 173
174class FontConfig : public QWidget 174class FontConfig : public QWidget
175{ 175{
176 Q_OBJECT 176 Q_OBJECT
177 177
178public: 178public:
179 179
180 FontConfig( QWidget *parent = 0, char *name = 0 ); 180 FontConfig( QWidget *parent = 0, char *name = 0 );
181 ~FontConfig(); 181 ~FontConfig();
182 182
183 void setFont ( const QFont &font ); 183 void setFont ( const QFont &font );
184 QFont getFont ( ) { return myFont; }; 184 QFont getFont ( ) { return myFont; };
185 185
186 private: 186 private:
187 Opie::OFontSelector *m_fontselect; 187 Opie::Opie::Ui::OFontSelector *m_fontselect;
188// class KFontChooser *m_fontchooser; 188// class KFontChooser *m_fontchooser;
189 QFont myFont; 189 QFont myFont;
190 190
191 private slots: 191 private slots:
192 void slotFontSelected( const QFont &font ); 192 void slotFontSelected( const QFont &font );
193}; 193};
194 194
195 195
196#endif //_KWDIALOG_H_ 196#endif //_KWDIALOG_H_
diff --git a/noncore/apps/tinykate/main.cpp b/noncore/apps/tinykate/main.cpp
index e62930c..c14d10a 100644
--- a/noncore/apps/tinykate/main.cpp
+++ b/noncore/apps/tinykate/main.cpp
@@ -1,22 +1,25 @@
1/*************************************************************************** 1/***************************************************************************
2
2 main.cpp 3 main.cpp
3 ------------------- 4 -------------------
4 begin : November 2002 5 begin : November 2002
5 copyright : (C) 2002 by Joseph Wenninger <jowenn@kde.org> 6 copyright : (C) 2002 by Joseph Wenninger <jowenn@kde.org>
6 ***************************************************************************/ 7 ***************************************************************************/
7 8
8/*************************************************************************** 9/***************************************************************************
9 * * 10 * *
10 * This program is free software; you can redistribute it and/or modify * 11 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by * 12 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation. * 13 * the Free Software Foundation. *
13 * ONLY VERSION 2 OF THE LICENSE IS APPLICABLE * 14 * ONLY VERSION 2 OF THE LICENSE IS APPLICABLE *
14 * * 15 * *
15 ***************************************************************************/ 16 ***************************************************************************/
16 17
17#include <opie2/oapplicationfactory.h> 18#include <opie2/oapplicationfactory.h>
18 19
19#include "tinykate.h" 20#include "tinykate.h"
20 21
22using namespace Opie::Core;
23
21OPIE_EXPORT_APP( OApplicationFactory<TinyKate> ) 24OPIE_EXPORT_APP( OApplicationFactory<TinyKate> )
22 25
diff --git a/noncore/apps/tinykate/tinykate.cpp b/noncore/apps/tinykate/tinykate.cpp
index 32c1eab..3c9a637 100644
--- a/noncore/apps/tinykate/tinykate.cpp
+++ b/noncore/apps/tinykate/tinykate.cpp
@@ -1,278 +1,279 @@
1/*************************************************************************** 1/***************************************************************************
2 tinykate.cpp 2 tinykate.cpp
3 Tiny KATE mainwindow 3 Tiny KATE mainwindow
4 ------------------- 4 -------------------
5 begin : November 2002 5 begin : November 2002
6 copyright : (C) 2002 by Joseph Wenninger <jowenn@kde.org> 6 copyright : (C) 2002 by Joseph Wenninger <jowenn@kde.org>
7 ***************************************************************************/ 7 ***************************************************************************/
8 8
9/*************************************************************************** 9/***************************************************************************
10 * * 10 * *
11 * This program is free softwaSre; you can redistribute it and/or modify * 11 * This program is free softwaSre; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by * 12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation. * 13 * the Free Software Foundation. *
14 * ONLY VERSION 2 OF THE LICENSE IS APPLICABLE * 14 * ONLY VERSION 2 OF THE LICENSE IS APPLICABLE *
15 * * 15 * *
16 ***************************************************************************/ 16 ***************************************************************************/
17#include <qaction.h> 17#include <qaction.h>
18#include <qtoolbutton.h> 18#include <qtoolbutton.h>
19#include <qmenubar.h> 19#include <qmenubar.h>
20#include <qpe/resource.h> 20#include <qpe/resource.h>
21#include <qpe/qpeapplication.h> 21#include <qpe/qpeapplication.h>
22 22
23#include <opie2/ofiledialog.h> 23#include <opie2/ofiledialog.h>
24 24
25#include "tinykate.h" 25#include "tinykate.h"
26 26
27#include <katedocument.h> 27#include <katedocument.h>
28#include <kglobal.h> 28#include <kglobal.h>
29 29
30using namespace Opie::Ui;
30TinyKate::TinyKate( QWidget *parent, const char *name, WFlags f) : 31TinyKate::TinyKate( QWidget *parent, const char *name, WFlags f) :
31 QMainWindow( parent, name, f ) 32 QMainWindow( parent, name, f )
32{ 33{
33 shutDown=false; 34 shutDown=false;
34 nextUnnamed=0; 35 nextUnnamed=0;
35 currentView=0; 36 currentView=0;
36 viewCount=0; 37 viewCount=0;
37 setCaption(tr("TinyKATE")); 38 setCaption(tr("TinyKATE"));
38 KGlobal::setAppName("TinyKATE"); 39 KGlobal::setAppName("TinyKATE");
39 40
40 QMenuBar *mb = new QMenuBar( this ); 41 QMenuBar *mb = new QMenuBar( this );
41 mb->setMargin( 0 ); 42 mb->setMargin( 0 );
42 43
43 tabwidget=new OTabWidget(this); 44 tabwidget=new OTabWidget(this);
44 setCentralWidget(tabwidget); 45 setCentralWidget(tabwidget);
45 connect(tabwidget,SIGNAL(currentChanged(QWidget*)),this,SLOT(slotCurrentChanged(QWidget*))); 46 connect(tabwidget,SIGNAL(currentChanged(QWidget*)),this,SLOT(slotCurrentChanged(QWidget*)));
46 47
47//FILE ACTIONS 48//FILE ACTIONS
48 QPopupMenu *popup = new QPopupMenu( this ); 49 QPopupMenu *popup = new QPopupMenu( this );
49 50
50 // Action for creating a new document 51 // Action for creating a new document
51 QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); 52 QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 );
52 a->addTo( popup ); 53 a->addTo( popup );
53 connect(a, SIGNAL(activated()), this, SLOT(slotNew())); 54 connect(a, SIGNAL(activated()), this, SLOT(slotNew()));
54 55
55 // Action for opening an exisiting document 56 // Action for opening an exisiting document
56 a = new QAction( tr( "Open" ),Resource::loadPixmap( "fileopen" ) , QString::null, 0, this, 0 ); 57 a = new QAction( tr( "Open" ),Resource::loadPixmap( "fileopen" ) , QString::null, 0, this, 0 );
57 a->addTo(popup); 58 a->addTo(popup);
58 connect(a, SIGNAL(activated()), this, SLOT(slotOpen())); 59 connect(a, SIGNAL(activated()), this, SLOT(slotOpen()));
59 60
60 61
61 // Action for saving document 62 // Action for saving document
62 a = new QAction( tr( "Save" ), Resource::loadPixmap( "save" ) , QString::null, 0, this, 0 ); 63 a = new QAction( tr( "Save" ), Resource::loadPixmap( "save" ) , QString::null, 0, this, 0 );
63 a->addTo(popup); 64 a->addTo(popup);
64 connect(a, SIGNAL(activated()), this, SLOT(slotSave())); 65 connect(a, SIGNAL(activated()), this, SLOT(slotSave()));
65 66
66 // Action for saving document to a new name 67 // Action for saving document to a new name
67 a = new QAction( tr( "Save As" ),Resource::loadPixmap( "save" ) , QString::null, 0, this, 0 ); 68 a = new QAction( tr( "Save As" ),Resource::loadPixmap( "save" ) , QString::null, 0, this, 0 );
68 a->addTo(popup); 69 a->addTo(popup);
69 connect(a, SIGNAL(activated()), this, SLOT(slotSaveAs())); 70 connect(a, SIGNAL(activated()), this, SLOT(slotSaveAs()));
70 71
71 // Action for closing the currently active document 72 // Action for closing the currently active document
72 a = new QAction( tr( "Close" ), Resource::loadPixmap( "quit_icon" ) , QString::null, 0, this, 0 ); 73 a = new QAction( tr( "Close" ), Resource::loadPixmap( "quit_icon" ) , QString::null, 0, this, 0 );
73 a->addTo(popup); 74 a->addTo(popup);
74 connect(a, SIGNAL(activated()), this, SLOT(slotClose())); 75 connect(a, SIGNAL(activated()), this, SLOT(slotClose()));
75 76
76 77
77 mb->insertItem(tr("File"),popup); 78 mb->insertItem(tr("File"),popup);
78 79
79//EDIT ACTIONS 80//EDIT ACTIONS
80 81
81 // Action for cutting text 82 // Action for cutting text
82 editCut = new QToolButton( 0 ); 83 editCut = new QToolButton( 0 );
83 editCut->setAutoRaise( true ); 84 editCut->setAutoRaise( true );
84 editCut->setIconSet( Resource::loadPixmap( "cut" ) ); 85 editCut->setIconSet( Resource::loadPixmap( "cut" ) );
85 86
86 // Action for Copying text 87 // Action for Copying text
87 editCopy = new QToolButton( 0 ); 88 editCopy = new QToolButton( 0 );
88 editCopy->setAutoRaise( true ); 89 editCopy->setAutoRaise( true );
89 editCopy->setIconSet( Resource::loadPixmap( "copy" ) ); 90 editCopy->setIconSet( Resource::loadPixmap( "copy" ) );
90 91
91 // Action for pasting text 92 // Action for pasting text
92 editPaste = new QToolButton( 0 ); 93 editPaste = new QToolButton( 0 );
93 editPaste->setAutoRaise( true ); 94 editPaste->setAutoRaise( true );
94 editPaste->setIconSet( Resource::loadPixmap( "paste" ) ); 95 editPaste->setIconSet( Resource::loadPixmap( "paste" ) );
95 96
96 // Action for finding / replacing text 97 // Action for finding / replacing text
97 editFindReplace = new QToolButton( 0 ); 98 editFindReplace = new QToolButton( 0 );
98 editFindReplace->setAutoRaise( true ); 99 editFindReplace->setAutoRaise( true );
99 editFindReplace->setIconSet( Resource::loadPixmap("find") ); 100 editFindReplace->setIconSet( Resource::loadPixmap("find") );
100 101
101 // Action for undo 102 // Action for undo
102 editUndo = new QToolButton( 0 ); 103 editUndo = new QToolButton( 0 );
103 editUndo->setAutoRaise( true ); 104 editUndo->setAutoRaise( true );
104 editUndo->setIconSet( Resource::loadPixmap( "undo" ) ); 105 editUndo->setIconSet( Resource::loadPixmap( "undo" ) );
105 106
106 // Action for redo 107 // Action for redo
107 editRedo = new QToolButton( 0 ); 108 editRedo = new QToolButton( 0 );
108 editRedo->setAutoRaise( true ); 109 editRedo->setAutoRaise( true );
109 editRedo->setIconSet( Resource::loadPixmap( "redo" ) ); 110 editRedo->setIconSet( Resource::loadPixmap( "redo" ) );
110 111
111//VIEW ACITONS 112//VIEW ACITONS
112 popup = new QPopupMenu( this ); 113 popup = new QPopupMenu( this );
113 114
114 viewIncFontSizes = new QAction( tr( "Font +" ), QString::null, 0, this, 0 ); 115 viewIncFontSizes = new QAction( tr( "Font +" ), QString::null, 0, this, 0 );
115 viewIncFontSizes->addTo( popup ); 116 viewIncFontSizes->addTo( popup );
116 117
117 viewDecFontSizes = new QAction( tr( "Font -" ), QString::null, 0, this, 0 ); 118 viewDecFontSizes = new QAction( tr( "Font -" ), QString::null, 0, this, 0 );
118 viewDecFontSizes->addTo( popup ); 119 viewDecFontSizes->addTo( popup );
119 120
120 mb->insertItem(tr("View"),popup); 121 mb->insertItem(tr("View"),popup);
121 122
122 popup = new QPopupMenu( this ); 123 popup = new QPopupMenu( this );
123 mb->insertItem(tr("Utils"),popup); 124 mb->insertItem(tr("Utils"),popup);
124 125
125 126
126 mb->insertItem( editCut ); 127 mb->insertItem( editCut );
127 mb->insertItem( editCopy ); 128 mb->insertItem( editCopy );
128 mb->insertItem( editPaste ); 129 mb->insertItem( editPaste );
129 mb->insertItem( editFindReplace ); 130 mb->insertItem( editFindReplace );
130 mb->insertItem( editUndo ); 131 mb->insertItem( editUndo );
131 mb->insertItem( editRedo ); 132 mb->insertItem( editRedo );
132 133
133 134
134//Highlight management 135//Highlight management
135 hlmenu=new QPopupMenu(this); 136 hlmenu=new QPopupMenu(this);
136 HlManager *hlm=HlManager::self(); 137 HlManager *hlm=HlManager::self();
137 for (int i=0;i<hlm->highlights();i++) 138 for (int i=0;i<hlm->highlights();i++)
138 { 139 {
139 hlmenu->insertItem(hlm->hlName(i),i); 140 hlmenu->insertItem(hlm->hlName(i),i);
140 } 141 }
141 popup->insertItem(tr("Highlighting"),hlmenu); 142 popup->insertItem(tr("Highlighting"),hlmenu);
142 143
143 144
144 utilSettings = new QAction( tr( "Settings" ), QString::null, 0, this, 0 ); 145 utilSettings = new QAction( tr( "Settings" ), QString::null, 0, this, 0 );
145 utilSettings->addTo( popup); 146 utilSettings->addTo( popup);
146 147
147 if( qApp->argc() > 1) open(qApp->argv()[1]); 148 if( qApp->argc() > 1) open(qApp->argv()[1]);
148 else slotNew(); 149 else slotNew();
149 150
150} 151}
151 152
152TinyKate::~TinyKate( ) 153TinyKate::~TinyKate( )
153{ 154{
154 qWarning("TinyKate destructor\n"); 155 qWarning("TinyKate destructor\n");
155 156
156 shutDown=true; 157 shutDown=true;
157 while (currentView!=0) { 158 while (currentView!=0) {
158 slotClose(); 159 slotClose();
159 } 160 }
160 161
161 if( KGlobal::config() != 0 ) { 162 if( KGlobal::config() != 0 ) {
162 qWarning("deleting KateConfig object..\n"); 163 qWarning("deleting KateConfig object..\n");
163 delete KGlobal::config(); 164 delete KGlobal::config();
164 } 165 }
165} 166}
166 167
167void TinyKate::slotOpen( ) 168void TinyKate::slotOpen( )
168{ 169{
169 QString filename = Opie::OFileDialog::getOpenFileName( OFileSelector::EXTENDED_ALL, 170 QString filename = OFileDialog::getOpenFileName( OFileSelector::EXTENDED_ALL,
170 QString::null); 171 QString::null);
171 if (!filename.isEmpty()) { 172 if (!filename.isEmpty()) {
172 open(filename); 173 open(filename);
173 } 174 }
174} 175}
175 176
176void TinyKate::open(const QString & filename) 177void TinyKate::open(const QString & filename)
177{ 178{
178 KateDocument *kd= new KateDocument(false, false, this,0,this); 179 KateDocument *kd= new KateDocument(false, false, this,0,this);
179 KTextEditor::View *kv; 180 KTextEditor::View *kv;
180 QFileInfo fi(filename); 181 QFileInfo fi(filename);
181 QString filenamed = fi.fileName(); 182 QString filenamed = fi.fileName();
182 tabwidget->addTab(kv=kd->createView(tabwidget,"bLAH"),"tinykate/tinykate", filenamed ); 183 tabwidget->addTab(kv=kd->createView(tabwidget,"bLAH"),"tinykate/tinykate", filenamed );
183 qDebug(filename); 184 qDebug(filename);
184 185
185 kd->setDocName( filenamed); 186 kd->setDocName( filenamed);
186 kd->open( filename ); 187 kd->open( filename );
187 viewCount++; 188 viewCount++;
188} 189}
189 190
190void TinyKate::setDocument(const QString& fileref) 191void TinyKate::setDocument(const QString& fileref)
191{ 192{
192 open( fileref ); 193 open( fileref );
193} 194}
194 195
195void TinyKate::slotCurrentChanged( QWidget * view) 196void TinyKate::slotCurrentChanged( QWidget * view)
196{ 197{
197 if (currentView) { 198 if (currentView) {
198 199
199 disconnect(editCopy,SIGNAL(activated()),currentView,SLOT(copy())); 200 disconnect(editCopy,SIGNAL(activated()),currentView,SLOT(copy()));
200 disconnect(editCut,SIGNAL(activated()),currentView,SLOT(cut())); 201 disconnect(editCut,SIGNAL(activated()),currentView,SLOT(cut()));
201 disconnect(editPaste,SIGNAL(activated()),currentView,SLOT(paste())); 202 disconnect(editPaste,SIGNAL(activated()),currentView,SLOT(paste()));
202 disconnect(editUndo,SIGNAL(activated()),currentView,SLOT(undo())); 203 disconnect(editUndo,SIGNAL(activated()),currentView,SLOT(undo()));
203 disconnect(editRedo,SIGNAL(activated()),currentView,SLOT(redo())); 204 disconnect(editRedo,SIGNAL(activated()),currentView,SLOT(redo()));
204 disconnect(viewIncFontSizes,SIGNAL(activated()), currentView,SLOT(slotIncFontSizes())); 205 disconnect(viewIncFontSizes,SIGNAL(activated()), currentView,SLOT(slotIncFontSizes()));
205 disconnect(viewDecFontSizes,SIGNAL(activated()), currentView,SLOT(slotDecFontSizes())); 206 disconnect(viewDecFontSizes,SIGNAL(activated()), currentView,SLOT(slotDecFontSizes()));
206 disconnect(hlmenu,SIGNAL(activated(int)), currentView,SLOT(setHl(int))); 207 disconnect(hlmenu,SIGNAL(activated(int)), currentView,SLOT(setHl(int)));
207 disconnect(utilSettings,SIGNAL(activated()), currentView,SLOT(configDialog())); 208 disconnect(utilSettings,SIGNAL(activated()), currentView,SLOT(configDialog()));
208 } 209 }
209 210
210 currentView=(KTextEditor::View*)view; 211 currentView=(KTextEditor::View*)view;
211 212
212 connect(editCopy,SIGNAL(clicked()),currentView,SLOT(copy())); 213 connect(editCopy,SIGNAL(clicked()),currentView,SLOT(copy()));
213 connect(editCut,SIGNAL(clicked()),currentView,SLOT(cut())); 214 connect(editCut,SIGNAL(clicked()),currentView,SLOT(cut()));
214 connect(editPaste,SIGNAL(clicked()),currentView,SLOT(paste())); 215 connect(editPaste,SIGNAL(clicked()),currentView,SLOT(paste()));
215 connect(editUndo,SIGNAL(clicked()),currentView,SLOT(undo())); 216 connect(editUndo,SIGNAL(clicked()),currentView,SLOT(undo()));
216 connect(editRedo,SIGNAL(clicked()),currentView,SLOT(redo())); 217 connect(editRedo,SIGNAL(clicked()),currentView,SLOT(redo()));
217 connect(viewIncFontSizes,SIGNAL(activated()), currentView,SLOT(slotIncFontSizes())); 218 connect(viewIncFontSizes,SIGNAL(activated()), currentView,SLOT(slotIncFontSizes()));
218 connect(viewDecFontSizes,SIGNAL(activated()), currentView,SLOT(slotDecFontSizes())); 219 connect(viewDecFontSizes,SIGNAL(activated()), currentView,SLOT(slotDecFontSizes()));
219 connect(hlmenu,SIGNAL(activated(int)), currentView,SLOT(setHl(int))); 220 connect(hlmenu,SIGNAL(activated(int)), currentView,SLOT(setHl(int)));
220 connect(utilSettings,SIGNAL(activated()), currentView,SLOT(configDialog())); 221 connect(utilSettings,SIGNAL(activated()), currentView,SLOT(configDialog()));
221 222
222} 223}
223 224
224void TinyKate::slotNew( ) 225void TinyKate::slotNew( )
225{ 226{
226 KateDocument *kd= new KateDocument(false, false, this,0,this); 227 KateDocument *kd= new KateDocument(false, false, this,0,this);
227 KTextEditor::View *kv; 228 KTextEditor::View *kv;
228 tabwidget->addTab(kv=kd->createView(tabwidget,"BLAH"), 229 tabwidget->addTab(kv=kd->createView(tabwidget,"BLAH"),
229 "tinykate/tinykate", 230 "tinykate/tinykate",
230 tr("Unnamed %1").arg(nextUnnamed++)); 231 tr("Unnamed %1").arg(nextUnnamed++));
231 viewCount++; 232 viewCount++;
232} 233}
233 234
234void TinyKate::slotClose( ) 235void TinyKate::slotClose( )
235{ 236{
236 if (currentView==0) return; 237 if (currentView==0) return;
237 KTextEditor::View *dv=currentView; 238 KTextEditor::View *dv=currentView;
238 currentView=0; 239 currentView=0;
239 tabwidget->removePage(dv); 240 tabwidget->removePage(dv);
240 delete dv->document(); 241 delete dv->document();
241 viewCount--; 242 viewCount--;
242 if ((!viewCount) && (!shutDown)) slotNew(); 243 if ((!viewCount) && (!shutDown)) slotNew();
243} 244}
244 245
245void TinyKate::slotSave() { 246void TinyKate::slotSave() {
246 // feel free to make this how you want 247 // feel free to make this how you want
247 if (currentView==0) return; 248 if (currentView==0) return;
248 249
249 // KateView *kv = (KateView*) currentView; 250 // KateView *kv = (KateView*) currentView;
250 KateDocument *kd = (KateDocument*) currentView->document(); 251 KateDocument *kd = (KateDocument*) currentView->document();
251 // qDebug("saving file "+kd->docName()); 252 // qDebug("saving file "+kd->docName());
252 if( kd->docName().isEmpty()) 253 if( kd->docName().isEmpty())
253 slotSaveAs(); 254 slotSaveAs();
254 else 255 else
255 kd->saveFile(); 256 kd->saveFile();
256 // kv->save(); 257 // kv->save();
257 // kd->saveFile(); 258 // kd->saveFile();
258} 259}
259 260
260void TinyKate::slotSaveAs() { 261void TinyKate::slotSaveAs() {
261 if (currentView==0) return; 262 if (currentView==0) return;
262 KateDocument *kd = (KateDocument*) currentView->document(); 263 KateDocument *kd = (KateDocument*) currentView->document();
263 264
264 QString filename= Opie::OFileDialog::getSaveFileName(OFileSelector::EXTENDED_ALL, 265 QString filename= OFileDialog::getSaveFileName(OFileSelector::EXTENDED_ALL,
265 QString::null); 266 QString::null);
266 if (!filename.isEmpty()) { 267 if (!filename.isEmpty()) {
267 qDebug("saving file "+filename); 268 qDebug("saving file "+filename);
268 QFileInfo fi(filename); 269 QFileInfo fi(filename);
269 QString filenamed = fi.fileName(); 270 QString filenamed = fi.fileName();
270 kd->setDocFile( filename); 271 kd->setDocFile( filename);
271 kd->setDocName( filenamed); 272 kd->setDocName( filenamed);
272 kd->saveFile(); 273 kd->saveFile();
273// KTextEditor::View *dv = currentView; 274// KTextEditor::View *dv = currentView;
274// tabwidget->changeTab( dv, filenamed); 275// tabwidget->changeTab( dv, filenamed);
275 // need to change tab label here 276 // need to change tab label here
276 } 277 }
277 278
278} 279}
diff --git a/noncore/apps/tinykate/tinykate.h b/noncore/apps/tinykate/tinykate.h
index f844c55..f435c03 100644
--- a/noncore/apps/tinykate/tinykate.h
+++ b/noncore/apps/tinykate/tinykate.h
@@ -1,66 +1,66 @@
1/*************************************************************************** 1/***************************************************************************
2 tinykate.h 2 tinykate.h
3 Tiny KATE mainwindow 3 Tiny KATE mainwindow
4 ------------------- 4 -------------------
5 begin : November 2002 5 begin : November 2002
6 copyright : (C) 2002 by Joseph Wenninger <jowenn@kde.org> 6 copyright : (C) 2002 by Joseph Wenninger <jowenn@kde.org>
7 ***************************************************************************/ 7 ***************************************************************************/
8 8
9/*************************************************************************** 9/***************************************************************************
10 * * 10 * *
11 * This program is free software; you can redistribute it and/or modify * 11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by * 12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation. * 13 * the Free Software Foundation. *
14 * ONLY VERSION 2 OF THE LICENSE IS APPLICABLE * 14 * ONLY VERSION 2 OF THE LICENSE IS APPLICABLE *
15 * * 15 * *
16 ***************************************************************************/ 16 ***************************************************************************/
17 17
18#ifndef __TINYKATE_H__ 18#ifndef __TINYKATE_H__
19#define __TINYKATE_H__ 19#define __TINYKATE_H__
20 20
21 21
22#include <qmainwindow.h> 22#include <qmainwindow.h>
23#include <opie2/otabwidget.h> 23#include <opie2/otabwidget.h>
24#include <ktexteditor.h> 24#include <ktexteditor.h>
25 25
26class QToolButton; 26class QToolButton;
27class QAction; 27class QAction;
28class QPopupMenu; 28class QPopupMenu;
29 29
30class TinyKate : public QMainWindow 30class TinyKate : public QMainWindow
31{ 31{
32Q_OBJECT 32Q_OBJECT
33public: 33public:
34 TinyKate( QWidget *parent=0, const char *name=0, WFlags f = 0); 34 TinyKate( QWidget *parent=0, const char *name=0, WFlags f = 0);
35 ~TinyKate( ); 35 ~TinyKate( );
36 static QString appName() { return QString::fromLatin1( "kate" ); }; 36 static QString appName() { return QString::fromLatin1( "kate" ); };
37 37
38 38
39public slots: 39public slots:
40 void slotNew(); 40 void slotNew();
41 void setDocument(const QString& fileref); 41 void setDocument(const QString& fileref);
42 42
43protected slots: 43protected slots:
44 void slotOpen(); 44 void slotOpen();
45 void slotClose(); 45 void slotClose();
46 void slotCurrentChanged(QWidget *); 46 void slotCurrentChanged(QWidget *);
47 void slotSave(); 47 void slotSave();
48 void slotSaveAs(); 48 void slotSaveAs();
49protected: 49protected:
50 void open(const QString&); 50 void open(const QString&);
51private: 51private:
52 QString currentFileName; 52 QString currentFileName;
53 OTabWidget *tabwidget; 53 Opie::Ui::OTabWidget *tabwidget;
54 KTextEditor::View *currentView; 54 KTextEditor::View *currentView;
55 bool shutDown; 55 bool shutDown;
56 56
57 QToolButton *editCopy, *editCut, *editPaste, *editUndo, *editRedo, *editFindReplace; 57 QToolButton *editCopy, *editCut, *editPaste, *editUndo, *editRedo, *editFindReplace;
58 QAction *viewIncFontSizes, *viewDecFontSizes, *utilSettings; 58 QAction *viewIncFontSizes, *viewDecFontSizes, *utilSettings;
59 59
60 QPopupMenu *hlmenu; 60 QPopupMenu *hlmenu;
61 uint nextUnnamed; 61 uint nextUnnamed;
62 uint viewCount; 62 uint viewCount;
63}; 63};
64 64
65 65
66#endif // __TINYKATE_H__ 66#endif // __TINYKATE_H__
diff --git a/noncore/apps/zsafe/zsafe.cpp b/noncore/apps/zsafe/zsafe.cpp
index a3467e5..3df55eb 100644
--- a/noncore/apps/zsafe/zsafe.cpp
+++ b/noncore/apps/zsafe/zsafe.cpp
@@ -1,226 +1,225 @@
1/**************************************************************************** 1/****************************************************************************
2** 2**
3** Created: Sat Apr 6 17:57:45 2002 3** Created: Sat Apr 6 17:57:45 2002
4** 4**
5** Author: Carsten Schneider <CarstenSchneider@t-online.de> 5** Author: Carsten Schneider <CarstenSchneider@t-online.de>
6** 6**
7** $Id$ 7** $Id$
8** 8**
9** Homepage: http://home.t-online.de/home/CarstenSchneider/zsafe/index.html 9** Homepage: http://home.t-online.de/home/CarstenSchneider/zsafe/index.html
10** 10**
11** Compile Flags: 11** Compile Flags:
12** Zaurus arm : -DNO_OPIE 12** Zaurus arm : -DNO_OPIE
13** Zaurus Opie arm: none 13** Zaurus Opie arm: none
14** Linux Desktop : -DDESKTOP 14** Linux Desktop : -DDESKTOP
15** Windows Desktop: -DDESKTOP -DWIN32 15** Windows Desktop: -DDESKTOP -DWIN32
16** 16**
17** for japanese version additional use: -DJPATCH_HDE 17** for japanese version additional use: -DJPATCH_HDE
18** 18**
19****************************************************************************/ 19****************************************************************************/
20#include "zsafe.h" 20#include "zsafe.h"
21#include "newdialog.h" 21#include "newdialog.h"
22#include "searchdialog.h" 22#include "searchdialog.h"
23#include "categorydialog.h" 23#include "categorydialog.h"
24#include "passworddialog.h" 24#include "passworddialog.h"
25#include "infoform.h" 25#include "infoform.h"
26#include "zlistview.h" 26#include "zlistview.h"
27#include "shadedlistitem.h" 27#include "shadedlistitem.h"
28 28
29#ifndef DESKTOP 29#ifndef DESKTOP
30#ifndef NO_OPIE 30#ifndef NO_OPIE
31#include <opie2/ofiledialog.h> 31#include <opie2/ofiledialog.h>
32 32
33using Opie::OFileDialog; 33using namespace Opie::Ui;
34using Opie::OFileSelector;
35#else 34#else
36#include "scqtfileedit.h" 35#include "scqtfileedit.h"
37#endif 36#endif
38#endif 37#endif
39 38
40#include <qclipboard.h> 39#include <qclipboard.h>
41 40
42#include <stdio.h> 41#include <stdio.h>
43 42
44#include <sys/types.h> 43#include <sys/types.h>
45#include <sys/stat.h> 44#include <sys/stat.h>
46#include <fcntl.h> 45#include <fcntl.h>
47#include <stdlib.h> 46#include <stdlib.h>
48#ifndef WIN32 47#ifndef WIN32
49#include <unistd.h> 48#include <unistd.h>
50#endif 49#endif
51#include <string.h> 50#include <string.h>
52#include <errno.h> 51#include <errno.h>
53 52
54#include <qmenubar.h> 53#include <qmenubar.h>
55#include <qpopupmenu.h> 54#include <qpopupmenu.h>
56 55
57#ifdef DESKTOP 56#ifdef DESKTOP
58#include <qfiledialog.h> 57#include <qfiledialog.h>
59#ifndef WIN32 58#ifndef WIN32
60#include <qsettings.h> 59#include <qsettings.h>
61#else 60#else
62#include "qsettings.h" 61#include "qsettings.h"
63#endif 62#endif
64#include <qapplication.h> 63#include <qapplication.h>
65#else 64#else
66#include <qfile.h> 65#include <qfile.h>
67#include <qpe/fileselector.h> 66#include <qpe/fileselector.h>
68#include <qpe/global.h> 67#include <qpe/global.h>
69#include <qpe/qpeapplication.h> 68#include <qpe/qpeapplication.h>
70#include <qpe/resource.h> 69#include <qpe/resource.h>
71#include <qpe/config.h> 70#include <qpe/config.h>
72#endif 71#endif
73 72
74#include <qtimer.h> 73#include <qtimer.h>
75#include <qlayout.h> 74#include <qlayout.h>
76#include <qmessagebox.h> 75#include <qmessagebox.h>
77#include <qfile.h> 76#include <qfile.h>
78#include <qtextstream.h> 77#include <qtextstream.h>
79#include <qheader.h> 78#include <qheader.h>
80#include <qlistview.h> 79#include <qlistview.h>
81#include <qtoolbutton.h> 80#include <qtoolbutton.h>
82#include <qvariant.h> 81#include <qvariant.h>
83#include <qtooltip.h> 82#include <qtooltip.h>
84#include <qwhatsthis.h> 83#include <qwhatsthis.h>
85#include <qimage.h> 84#include <qimage.h>
86#include <qpixmap.h> 85#include <qpixmap.h>
87#include <qlineedit.h> 86#include <qlineedit.h>
88#include <qmultilineedit.h> 87#include <qmultilineedit.h>
89#include <qregexp.h> 88#include <qregexp.h>
90#include <qdir.h> 89#include <qdir.h>
91#include <qtextbrowser.h> 90#include <qtextbrowser.h>
92#include <qlabel.h> 91#include <qlabel.h>
93#include <qcombobox.h> 92#include <qcombobox.h>
94 93
95#include "krc2.h" 94#include "krc2.h"
96 95
97#include "wait.h" 96#include "wait.h"
98 97
99extern int DeskW, DeskH; 98extern int DeskW, DeskH;
100#ifdef DESKTOP 99#ifdef DESKTOP
101extern QApplication *appl; 100extern QApplication *appl;
102#else 101#else
103extern QPEApplication *appl; 102extern QPEApplication *appl;
104#endif 103#endif
105 104
106#ifdef JPATCH_HDE 105#ifdef JPATCH_HDE
107#define tr(arg) arg 106#define tr(arg) arg
108#endif 107#endif
109 108
110 109
111#ifdef DESKTOP 110#ifdef DESKTOP
112#ifndef WIN32 111#ifndef WIN32
113const QString APP_KEY="/.zsafe/"; 112const QString APP_KEY="/.zsafe/";
114#else 113#else
115const QString APP_KEY=""; 114const QString APP_KEY="";
116#endif 115#endif
117#else 116#else
118const QString APP_KEY=""; 117const QString APP_KEY="";
119#endif 118#endif
120 119
121// include xmp images 120// include xmp images
122#include "pics/zsafe/copy.xpm" 121#include "pics/zsafe/copy.xpm"
123#include "pics/zsafe/cut.xpm" 122#include "pics/zsafe/cut.xpm"
124#include "pics/zsafe/edit.xpm" 123#include "pics/zsafe/edit.xpm"
125#include "pics/zsafe/editdelete.xpm" 124#include "pics/zsafe/editdelete.xpm"
126#include "pics/zsafe/find.xpm" 125#include "pics/zsafe/find.xpm"
127#include "pics/zsafe/folder_open.xpm" 126#include "pics/zsafe/folder_open.xpm"
128#include "pics/zsafe/help_icon.xpm" 127#include "pics/zsafe/help_icon.xpm"
129#include "pics/zsafe/new.xpm" 128#include "pics/zsafe/new.xpm"
130#include "pics/zsafe/paste.xpm" 129#include "pics/zsafe/paste.xpm"
131#include "pics/zsafe/quit_icon.xpm" 130#include "pics/zsafe/quit_icon.xpm"
132#include "pics/zsafe/save.xpm" 131#include "pics/zsafe/save.xpm"
133#include "pics/zsafe/trash.xpm" 132#include "pics/zsafe/trash.xpm"
134#include "pics/zsafe/expand.xpm" 133#include "pics/zsafe/expand.xpm"
135#include "pics/zsafe/export.xpm" 134#include "pics/zsafe/export.xpm"
136#include "pics/zsafe/import.xpm" 135#include "pics/zsafe/import.xpm"
137#include "pics/zsafe/zsafe.xpm" 136#include "pics/zsafe/zsafe.xpm"
138 137
139static const char* const bank_cards_data[] = { 138static const char* const bank_cards_data[] = {
140"14 14 16 1", 139"14 14 16 1",
141". c None", 140". c None",
142"# c #000000", 141"# c #000000",
143"b c #0000de", 142"b c #0000de",
144"a c #0000e6", 143"a c #0000e6",
145"j c #41de83", 144"j c #41de83",
146"k c #4acecd", 145"k c #4acecd",
147"h c #4aced5", 146"h c #4aced5",
148"g c #5a40cd", 147"g c #5a40cd",
149"d c #5a44d5", 148"d c #5a44d5",
150"l c #9440d5", 149"l c #9440d5",
151"m c #b4ce4a", 150"m c #b4ce4a",
152"n c #cd4883", 151"n c #cd4883",
153"e c #d5ae10", 152"e c #d5ae10",
154"f c #de3ce6", 153"f c #de3ce6",
155"i c #e640e6", 154"i c #e640e6",
156"c c #ffffff", 155"c c #ffffff",
157"..............", 156"..............",
158".###########..", 157".###########..",
159".#ababababa#..", 158".#ababababa#..",
160".#babbbabbb#..", 159".#babbbabbb#..",
161".#ccccccccc#..", 160".#ccccccccc#..",
162".#cdcefcghc#..", 161".#cdcefcghc#..",
163".#ccccccccc#..", 162".#ccccccccc#..",
164".#cicjkclic#..", 163".#cicjkclic#..",
165".#ccccccccc#..", 164".#ccccccccc#..",
166".#cmchlcnec#..", 165".#cmchlcnec#..",
167".#ccccccccc#..", 166".#ccccccccc#..",
168".###########..", 167".###########..",
169"..............", 168"..............",
170".............."}; 169".............."};
171 170
172 171
173static const char* const passwords_data[] = { 172static const char* const passwords_data[] = {
174"16 16 20 1", 173"16 16 20 1",
175". c None", 174". c None",
176"# c #000000", 175"# c #000000",
177"r c #000083", 176"r c #000083",
178"p c #0000c5", 177"p c #0000c5",
179"q c #0000ff", 178"q c #0000ff",
180"n c #008100", 179"n c #008100",
181"l c #00c200", 180"l c #00c200",
182"m c #00ff00", 181"m c #00ff00",
183"j c #838100", 182"j c #838100",
184"a c #c55900", 183"a c #c55900",
185"h c #c5c200", 184"h c #c5c200",
186"o c #c5c2ff", 185"o c #c5c2ff",
187"k c #c5ffc5", 186"k c #c5ffc5",
188"f c #ff0000", 187"f c #ff0000",
189"d c #ff8100", 188"d c #ff8100",
190"b c #ffaa5a", 189"b c #ffaa5a",
191"e c #ffc2c5", 190"e c #ffc2c5",
192"c c #ffdeac", 191"c c #ffdeac",
193"i c #ffff00", 192"i c #ffff00",
194"g c #ffffc5", 193"g c #ffffc5",
195"............###.", 194"............###.",
196"...........#abb#", 195"...........#abb#",
197"..........#cbab#", 196"..........#cbab#",
198".........#cbdd#.", 197".........#cbdd#.",
199"######..#cbdd#..", 198"######..#cbdd#..",
200"#eeff#..#add#...", 199"#eeff#..#add#...",
201"#eeff#######....", 200"#eeff#######....",
202"#ccdbdd#........", 201"#ccdbdd#........",
203"#dddbdd###......", 202"#dddbdd###......",
204"#gghihhjj#......", 203"#gghihhjj#......",
205"#hhhihhjj###....", 204"#hhhihhjj###....",
206"#kklmllnnnn#....", 205"#kklmllnnnn#....",
207"#lllmllnnnn#....", 206"#lllmllnnnn#....",
208"#oopqpprprr#....", 207"#oopqpprprr#....",
209"#oopqpprprr#....", 208"#oopqpprprr#....",
210"############...."}; 209"############...."};
211 210
212static const char* const software_data[] = { 211static const char* const software_data[] = {
213"16 16 5 1", 212"16 16 5 1",
214". c None", 213". c None",
215"# c #000000", 214"# c #000000",
216"b c #838183", 215"b c #838183",
217"c c #c5ffff", 216"c c #c5ffff",
218"a c #ffffff", 217"a c #ffffff",
219"................", 218"................",
220".##############.", 219".##############.",
221"#aaaaaaaaaaaaaa#", 220"#aaaaaaaaaaaaaa#",
222"#abbbbbbbbbbbbb#", 221"#abbbbbbbbbbbbb#",
223"#ab##########ab#", 222"#ab##########ab#",
224"#ab#c########ab#", 223"#ab#c########ab#",
225"#ab#c#c######ab#", 224"#ab#c#c######ab#",
226"#ab##########ab#", 225"#ab##########ab#",