summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-sheet/edit-accept.xpm30
-rw-r--r--noncore/apps/opie-sheet/edit-cancel.xpm25
-rw-r--r--noncore/apps/opie-sheet/file-new.xpm24
-rw-r--r--noncore/apps/opie-sheet/file-open.xpm25
-rw-r--r--noncore/apps/opie-sheet/file-save.xpm24
-rw-r--r--noncore/apps/opie-sheet/help-general.xpm25
-rw-r--r--noncore/apps/opie-sheet/mainwindow.cpp56
-rw-r--r--noncore/apps/opie-sheet/mainwindow.h1
8 files changed, 21 insertions, 189 deletions
diff --git a/noncore/apps/opie-sheet/edit-accept.xpm b/noncore/apps/opie-sheet/edit-accept.xpm
deleted file mode 100644
index 5109281..0000000
--- a/noncore/apps/opie-sheet/edit-accept.xpm
+++ b/dev/null
@@ -1,30 +0,0 @@
1/* XPM */
2static const char *edit_accept_xpm[] = {
3/* columns rows colors chars-per-pixel */
4"16 16 8 1",
5" c #000000000000",
6". c #000040400000",
7"X c #404000000000",
8"o c #000080800000",
9"O c #0000c0c00000",
10"+ c #c0c0ffffc0c0",
11"@ c #ffffffffffff",
12"# c None",
13/* pixels */
14"################",
15"################",
16"##############+#",
17"#############+O#",
18"############+Oo#",
19"###########+Oo.#",
20"##+o######+Oo. #",
21"#+OOo####+Oo.X##",
22" .oOOo##+Oo. ###",
23"# .oOOo+Oo.X####",
24"##X.oOOOo.X#####",
25"### .oOo. ######",
26"#### .o. #######",
27"##### X ########",
28"################",
29"################",
30};
diff --git a/noncore/apps/opie-sheet/edit-cancel.xpm b/noncore/apps/opie-sheet/edit-cancel.xpm
deleted file mode 100644
index 8e1606e..0000000
--- a/noncore/apps/opie-sheet/edit-cancel.xpm
+++ b/dev/null
@@ -1,25 +0,0 @@
1/* XPM */
2static const char *edit_cancel_xpm[] = {
3/* columns rows colors chars-per-pixel */
4"16 16 3 1",
5". c red",
6"X c #ffffffffffff",
7" c None",
8/* pixels */
9" ",
10" ",
11" ..... ",
12" ......... ",
13" ........... ",
14" ..XX...XX.. ",
15" ...XXX.XXX... ",
16" ....XXXXX.... ",
17" .....XXX..... ",
18" ....XXXXX.... ",
19" ...XXX.XXX... ",
20" ..XX...XX.. ",
21" ........... ",
22" ......... ",
23" ..... ",
24" ",
25};
diff --git a/noncore/apps/opie-sheet/file-new.xpm b/noncore/apps/opie-sheet/file-new.xpm
deleted file mode 100644
index ec8dd63..0000000
--- a/noncore/apps/opie-sheet/file-new.xpm
+++ b/dev/null
@@ -1,24 +0,0 @@
1/* XPM */
2static const char * file_new_xpm[] = {
3"16 16 5 1",
4 " c None",
5 ".c #808080",
6 "+c #FFFFFF",
7 "@c #C0C0C0",
8 "#c #000000",
9" .......... ",
10" .++++++++@. ",
11" .++++++++@+. ",
12" .++++++++#### ",
13" .++++++++++@# ",
14" .++++++++++@# ",
15" .++++++++++@# ",
16" .++++++++++@# ",
17" .++++++++++@# ",
18" .++++++++++@# ",
19" .++++++++++@# ",
20" .++++++++++@# ",
21" .++++++++++@# ",
22" .++++++++++@# ",
23" .@@@@@@@@@@@# ",
24" ############# "};
diff --git a/noncore/apps/opie-sheet/file-open.xpm b/noncore/apps/opie-sheet/file-open.xpm
deleted file mode 100644
index 8449d5b..0000000
--- a/noncore/apps/opie-sheet/file-open.xpm
+++ b/dev/null
@@ -1,25 +0,0 @@
1/* XPM */
2static const char * file_open_xpm[] = {
3"16 16 6 1",
4 " c None",
5 ".c #808080",
6 "+c #FFFFFF",
7 "@c #C0C0C0",
8 "#c #FFFF00",
9 "$c #000000",
10" ",
11" ..... ",
12" .+++++. ",
13" .+@#@#@+...... ",
14" .+#@#@#@+++++.$",
15" .+@#@#@#@#@#@.$",
16".............#.$",
17".++++++++++.$@.$",
18".+@#@#@#@#@#$..$",
19" .+@#@#@#@#@.$.$",
20" .+#@#@#@#@#@$.$",
21" .+#@#@#@#@#.$$",
22" ............$$",
23" $$$$$$$$$$$$$",
24" ",
25" "};
diff --git a/noncore/apps/opie-sheet/file-save.xpm b/noncore/apps/opie-sheet/file-save.xpm
deleted file mode 100644
index 039a174..0000000
--- a/noncore/apps/opie-sheet/file-save.xpm
+++ b/dev/null
@@ -1,24 +0,0 @@
1/* XPM */
2static const char * file_save_xpm[] = {
3"16 16 5 1",
4 " c None",
5 ".c #808080",
6 "+c #FFFFFF",
7 "@c #000000",
8 "#c #0000FF",
9" ",
10" ........ ",
11" .++++++.@ ",
12" .+....+.+@ #",
13" .++++++.@@@ ##",
14" .+....++++@ ##@",
15" .+++++++++@##@ ",
16" .+.......+##@ ",
17" .++++++++##@ ",
18" .+......@#@ ",
19" .++++++@@@@ ",
20" .+....@@@+@ ",
21" .++++@++++@ ",
22" .+++++++++@ ",
23" @@@@@@@@@@@ ",
24" "};
diff --git a/noncore/apps/opie-sheet/help-general.xpm b/noncore/apps/opie-sheet/help-general.xpm
deleted file mode 100644
index 9f10527..0000000
--- a/noncore/apps/opie-sheet/help-general.xpm
+++ b/dev/null
@@ -1,25 +0,0 @@
1/* XPM */
2static const char * help_general_xpm[] = {
3"16 16 6 1",
4 " c None s None",
5 ".c #000000",
6 "Xc #FF0000",
7 "oc #FFFF00",
8 "Oc #808080",
9 "+c #FFFFFF",
10" ",
11" .. ",
12" .XX. ",
13" .XXXX. ",
14" .XXXoXX. ",
15" .XXXoXoXX. ",
16" .XXXXXoXoX. ",
17" .XXXXXXXoX.O ",
18" ..XXXXXXX.+.O ",
19" .+.XXXXX.+.O ",
20" .+.XXX.+.O ",
21" .+.X.+.O ",
22" .+.+.O ",
23" .+.O ",
24" .O ",
25" "};
diff --git a/noncore/apps/opie-sheet/mainwindow.cpp b/noncore/apps/opie-sheet/mainwindow.cpp
index b9f8e57..43e5131 100644
--- a/noncore/apps/opie-sheet/mainwindow.cpp
+++ b/noncore/apps/opie-sheet/mainwindow.cpp
@@ -1,129 +1,126 @@
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#include "mainwindow.h" 15#include "mainwindow.h"
16 16
17#include <qpe/filemanager.h> 17#include <qpe/filemanager.h>
18#include <qpe/qcopenvelope_qws.h> 18#include <qpe/qcopenvelope_qws.h>
19#include <qpe/resource.h>
19#include <qmessagebox.h> 20#include <qmessagebox.h>
20#include <qfile.h> 21#include <qfile.h>
22#include <qtranslator.h>
21#include <qradiobutton.h> 23#include <qradiobutton.h>
22#include "cellformat.h" 24#include "cellformat.h"
23#include "numberdlg.h" 25#include "numberdlg.h"
24#include "textdlg.h" 26#include "textdlg.h"
25#include "sortdlg.h" 27#include "sortdlg.h"
26#include "finddlg.h" 28#include "finddlg.h"
27 29
28#include "file-new.xpm" 30
29#include "file-open.xpm"
30#include "file-save.xpm"
31#include "edit-cancel.xpm"
32#include "edit-accept.xpm"
33#include "help-general.xpm"
34#include "func-plus.xpm" 31#include "func-plus.xpm"
35#include "func-minus.xpm" 32#include "func-minus.xpm"
36#include "func-cross.xpm" 33#include "func-cross.xpm"
37#include "func-divide.xpm" 34#include "func-divide.xpm"
38#include "func-paran-open.xpm" 35#include "func-paran-open.xpm"
39#include "func-paran-close.xpm" 36#include "func-paran-close.xpm"
40#include "func-comma.xpm" 37#include "func-comma.xpm"
41#include "func-func.xpm" 38#include "func-func.xpm"
42#include "func-equal.xpm" 39#include "func-equal.xpm"
43#include "cell-select.xpm" 40#include "cell-select.xpm"
44 41
45#define DEFAULT_NUM_ROWS 199 42#define DEFAULT_NUM_ROWS 199
46#define DEFAULT_NUM_COLS (26*3) 43#define DEFAULT_NUM_COLS (26*3)
47#define DEFAULT_NUM_SHEETS 3 44#define DEFAULT_NUM_SHEETS 3
48 45
49MainWindow::MainWindow() 46MainWindow::MainWindow()
50 :QMainWindow() 47 :QMainWindow()
51{ 48{
52 // initialize variables 49 // initialize variables
53 documentModified=FALSE; 50 documentModified=FALSE;
54 51
55 // construct objects 52 // construct objects
56 currentDoc=0; 53 currentDoc=0;
57 fileSelector=new FileSelector("application/sheet-qt", this, QString::null); 54 fileSelector=new FileSelector("application/sheet-qt", this, QString::null);
58 connect(fileSelector, SIGNAL(closeMe()), this, SLOT(selectorHide())); 55 connect(fileSelector, SIGNAL(closeMe()), this, SLOT(selectorHide()));
59 connect(fileSelector, SIGNAL(newSelected(const DocLnk &)), this, SLOT(selectorFileNew(const DocLnk &))); 56 connect(fileSelector, SIGNAL(newSelected(const DocLnk &)), this, SLOT(selectorFileNew(const DocLnk &)));
60 connect(fileSelector, SIGNAL(fileSelected(const DocLnk &)), this, SLOT(selectorFileOpen(const DocLnk &))); 57 connect(fileSelector, SIGNAL(fileSelected(const DocLnk &)), this, SLOT(selectorFileOpen(const DocLnk &)));
61 58
62 listSheets.setAutoDelete(TRUE); 59 listSheets.setAutoDelete(TRUE);
63 60
64 initActions(); 61 initActions();
65 initMenu(); 62 initMenu();
66 initEditToolbar(); 63 initEditToolbar();
67 initFunctionsToolbar(); 64 initFunctionsToolbar();
68 initStandardToolbar(); 65 initStandardToolbar();
69 initSheet(); 66 initSheet();
70 67
71 // set window title 68 // set window title
72 setCaption(tr("Opie Sheet")); 69 setCaption(tr("Opie Sheet"));
73 70
74 // create sheets 71 // create sheets
75 selectorFileNew(DocLnk()); 72 selectorFileNew(DocLnk());
76} 73}
77 74
78MainWindow::~MainWindow() 75MainWindow::~MainWindow()
79{ 76{
80 if (currentDoc) delete currentDoc; 77 if (currentDoc) delete currentDoc;
81} 78}
82 79
83void MainWindow::documentSave(DocLnk *lnkDoc) 80void MainWindow::documentSave(DocLnk *lnkDoc)
84{ 81{
85 FileManager fm; 82 FileManager fm;
86 QByteArray streamBuffer; 83 QByteArray streamBuffer;
87 QDataStream stream(streamBuffer, IO_WriteOnly); 84 QDataStream stream(streamBuffer, IO_WriteOnly);
88 85
89 typeSheet *currentSheet=findSheet(sheet->getName()); 86 typeSheet *currentSheet=findSheet(sheet->getName());
90 if (!currentSheet) 87 if (!currentSheet)
91 { 88 {
92 QMessageBox::critical(this, tr("Error"), tr("Inconsistency error!")); 89 QMessageBox::critical(this, tr("Error"), tr("Inconsistency error!"));
93 return; 90 return;
94 } 91 }
95 sheet->copySheetData(&currentSheet->data); 92 sheet->copySheetData(&currentSheet->data);
96 stream.writeRawBytes("SQT100", 6); 93 stream.writeRawBytes("SQT100", 6);
97 stream << (Q_UINT32)listSheets.count(); 94 stream << (Q_UINT32)listSheets.count();
98 for (typeSheet *tempSheet=listSheets.first(); tempSheet; tempSheet=listSheets.next()) 95 for (typeSheet *tempSheet=listSheets.first(); tempSheet; tempSheet=listSheets.next())
99 { 96 {
100 stream << tempSheet->name << (Q_UINT32)tempSheet->data.count(); 97 stream << tempSheet->name << (Q_UINT32)tempSheet->data.count();
101 for (typeCellData *tempCell=tempSheet->data.first(); tempCell; tempCell=tempSheet->data.next()) 98 for (typeCellData *tempCell=tempSheet->data.first(); tempCell; tempCell=tempSheet->data.next())
102 stream << (Q_UINT32)tempCell->col << (Q_UINT32)tempCell->row << tempCell->borders.right << tempCell->borders.bottom << tempCell->background << (Q_UINT32)tempCell->alignment << tempCell->fontColor << tempCell->font << tempCell->data; 99 stream << (Q_UINT32)tempCell->col << (Q_UINT32)tempCell->row << tempCell->borders.right << tempCell->borders.bottom << tempCell->background << (Q_UINT32)tempCell->alignment << tempCell->fontColor << tempCell->font << tempCell->data;
103 } 100 }
104 101
105 lnkDoc->setType("application/sheet-qt"); 102 lnkDoc->setType("application/sheet-qt");
106 if (!fm.saveFile(*lnkDoc, streamBuffer)) 103 if (!fm.saveFile(*lnkDoc, streamBuffer))
107 { 104 {
108 QMessageBox::critical(this, tr("Error"), tr("File cannot be saved!")); 105 QMessageBox::critical(this, tr("Error"), tr("File cannot be saved!"));
109 return; 106 return;
110 } 107 }
111 documentModified=FALSE; 108 documentModified=FALSE;
112} 109}
113 110
114void MainWindow::documentOpen(const DocLnk &lnkDoc) 111void MainWindow::documentOpen(const DocLnk &lnkDoc)
115{ 112{
116 FileManager fm; 113 FileManager fm;
117 QByteArray streamBuffer; 114 QByteArray streamBuffer;
118 if (!lnkDoc.isValid() || !fm.loadFile(lnkDoc, streamBuffer)) 115 if (!lnkDoc.isValid() || !fm.loadFile(lnkDoc, streamBuffer))
119 { 116 {
120 QMessageBox::critical(this, tr("Error"), tr("File cannot be opened!")); 117 QMessageBox::critical(this, tr("Error"), tr("File cannot be opened!"));
121 documentModified=FALSE; 118 documentModified=FALSE;
122 selectorFileNew(DocLnk()); 119 selectorFileNew(DocLnk());
123 return; 120 return;
124 } 121 }
125 QDataStream stream(streamBuffer, IO_ReadOnly); 122 QDataStream stream(streamBuffer, IO_ReadOnly);
126 123
127 Q_UINT32 countSheet, countCell, i, j, row, col, alignment; 124 Q_UINT32 countSheet, countCell, i, j, row, col, alignment;
128 typeSheet *newSheet; 125 typeSheet *newSheet;
129 typeCellData *newCell; 126 typeCellData *newCell;
@@ -172,455 +169,444 @@ int MainWindow::saveCurrentFile(bool ask)
172 { 169 {
173 int result=QMessageBox::information(this, tr("Save File"), tr("Do you want to save the current file?"), QMessageBox::Yes, QMessageBox::No, QMessageBox::Cancel); 170 int result=QMessageBox::information(this, tr("Save File"), tr("Do you want to save the current file?"), QMessageBox::Yes, QMessageBox::No, QMessageBox::Cancel);
174 if (result!=QMessageBox::Yes) return result; 171 if (result!=QMessageBox::Yes) return result;
175 } 172 }
176 173
177 if (!currentDoc->isValid()) 174 if (!currentDoc->isValid())
178 { 175 {
179 TextDialog dialogText(this); 176 TextDialog dialogText(this);
180 if (dialogText.exec(tr("Save File"), tr("&File Name:"), tr("UnnamedFile"))!=QDialog::Accepted || dialogText.getValue().isEmpty()) return QMessageBox::Cancel; 177 if (dialogText.exec(tr("Save File"), tr("&File Name:"), tr("UnnamedFile"))!=QDialog::Accepted || dialogText.getValue().isEmpty()) return QMessageBox::Cancel;
181 178
182 currentDoc->setName(dialogText.getValue()); 179 currentDoc->setName(dialogText.getValue());
183 currentDoc->setFile(QString::null); 180 currentDoc->setFile(QString::null);
184 currentDoc->setLinkFile(QString::null); 181 currentDoc->setLinkFile(QString::null);
185 } 182 }
186 183
187 documentSave(currentDoc); 184 documentSave(currentDoc);
188 return QMessageBox::Yes; 185 return QMessageBox::Yes;
189} 186}
190 187
191void MainWindow::selectorFileNew(const DocLnk &lnkDoc) 188void MainWindow::selectorFileNew(const DocLnk &lnkDoc)
192{ 189{
193 selectorHide(); 190 selectorHide();
194 191
195 if (documentModified && saveCurrentFile()==QMessageBox::Cancel) return; 192 if (documentModified && saveCurrentFile()==QMessageBox::Cancel) return;
196 if (currentDoc) delete currentDoc; 193 if (currentDoc) delete currentDoc;
197 currentDoc = new DocLnk(lnkDoc); 194 currentDoc = new DocLnk(lnkDoc);
198 editData->clear(); 195 editData->clear();
199 listSheets.clear(); 196 listSheets.clear();
200 comboSheets->clear(); 197 comboSheets->clear();
201 198
202 typeSheet *newSheet=createNewSheet(); 199 typeSheet *newSheet=createNewSheet();
203 newSheet->data.setAutoDelete(TRUE); 200 newSheet->data.setAutoDelete(TRUE);
204 sheet->setName(newSheet->name); 201 sheet->setName(newSheet->name);
205 sheet->setSheetData(&newSheet->data); 202 sheet->setSheetData(&newSheet->data);
206 for (int i=1; i<DEFAULT_NUM_SHEETS; ++i) 203 for (int i=1; i<DEFAULT_NUM_SHEETS; ++i)
207 createNewSheet(); 204 createNewSheet();
208 documentModified=FALSE; 205 documentModified=FALSE;
209} 206}
210 207
211void MainWindow::closeEvent(QCloseEvent *e) 208void MainWindow::closeEvent(QCloseEvent *e)
212{ 209{
213 if (documentModified && saveCurrentFile()==QMessageBox::Cancel) e->ignore(); 210 if (documentModified && saveCurrentFile()==QMessageBox::Cancel) e->ignore();
214 else e->accept(); 211 else e->accept();
215} 212}
216 213
217void MainWindow::selectorFileOpen(const DocLnk &lnkDoc) 214void MainWindow::selectorFileOpen(const DocLnk &lnkDoc)
218{ 215{
219 selectorHide(); 216 selectorHide();
220 217
221 if (documentModified && saveCurrentFile()==QMessageBox::Cancel) return; 218 if (documentModified && saveCurrentFile()==QMessageBox::Cancel) return;
222 if (currentDoc) delete currentDoc; 219 if (currentDoc) delete currentDoc;
223 currentDoc = new DocLnk(lnkDoc); 220 currentDoc = new DocLnk(lnkDoc);
224 listSheets.clear(); 221 listSheets.clear();
225 comboSheets->clear(); 222 comboSheets->clear();
226 223
227 documentOpen(lnkDoc); 224 documentOpen(lnkDoc);
228 documentModified=FALSE; 225 documentModified=FALSE;
229} 226}
230 227
231void MainWindow::selectorShow() 228void MainWindow::selectorShow()
232{ 229{
233 sheet->hide(); 230 sheet->hide();
234 setCentralWidget(fileSelector); 231 setCentralWidget(fileSelector);
235 fileSelector->show(); 232 fileSelector->show();
236 fileSelector->reread(); 233 fileSelector->reread();
237} 234}
238 235
239void MainWindow::selectorHide() 236void MainWindow::selectorHide()
240{ 237{
241 fileSelector->hide(); 238 fileSelector->hide();
242 setCentralWidget(sheet); 239 setCentralWidget(sheet);
243 sheet->show(); 240 sheet->show();
244} 241}
245 242
246void MainWindow::slotFileNew() 243void MainWindow::slotFileNew()
247{ 244{
248 selectorFileNew(DocLnk()); 245 selectorFileNew(DocLnk());
249} 246}
250 247
251void MainWindow::slotFileOpen() 248void MainWindow::slotFileOpen()
252{ 249{
253 selectorShow(); 250 selectorShow();
254} 251}
255 252
256void MainWindow::slotFileSave() 253void MainWindow::slotFileSave()
257{ 254{
258 saveCurrentFile(FALSE); 255 saveCurrentFile(FALSE);
259} 256}
260 257
261void MainWindow::setDocument(const QString &applnk_filename) 258void MainWindow::setDocument(const QString &applnk_filename)
262{ 259{
263 selectorFileOpen(DocLnk(applnk_filename)); 260 selectorFileOpen(DocLnk(applnk_filename));
264} 261}
265 262
266void MainWindow::initActions() 263void MainWindow::initActions()
267{ 264{
268 fileNew=new QAction(tr("New File"), QPixmap(file_new_xpm), tr("&New"), 0, this); 265 fileNew=new QAction(tr("New File"), Resource::loadPixmap( "new" ), tr("&New"), 0, this);
269 connect(fileNew, SIGNAL(activated()), this, SLOT(slotFileNew())); 266 connect(fileNew, SIGNAL(activated()), this, SLOT(slotFileNew()));
270 fileOpen=new QAction(tr("Open File"), QPixmap(file_open_xpm), tr("&Open"), 0, this); 267 fileOpen=new QAction(tr("Open File"), Resource::loadPixmap( "fileopen" ), tr("&Open"), 0, this);
271 connect(fileOpen, SIGNAL(activated()), this, SLOT(slotFileOpen())); 268 connect(fileOpen, SIGNAL(activated()), this, SLOT(slotFileOpen()));
272 fileSave=new QAction(tr("Save File"), QPixmap(file_save_xpm), tr("&Save"), 0, this); 269 fileSave=new QAction(tr("Save File"),Resource::loadPixmap( "save" ), tr("&Save"), 0, this);
273 connect(fileSave, SIGNAL(activated()), this, SLOT(slotFileSave())); 270 connect(fileSave, SIGNAL(activated()), this, SLOT(slotFileSave()));
274 fileSaveAs=new QAction(tr("Save File As"), QPixmap(file_save_xpm), tr("Save &As"), 0, this); 271 fileSaveAs=new QAction(tr("Save File As"), Resource::loadPixmap( "save" ), tr("Save &As"), 0, this);
275 connect(fileSaveAs, SIGNAL(activated()), this, SLOT(slotFileSaveAs())); 272 connect(fileSaveAs, SIGNAL(activated()), this, SLOT(slotFileSaveAs()));
276 fileQuit=new QAction(tr("Quit"), tr("&Quit"), 0, this); 273 //fileQuit=new QAction(tr("Quit"), tr("&Quit"), 0, this);
277 connect(fileQuit, SIGNAL(activated()), this, SLOT(close())); 274 //connect(fileQuit, SIGNAL(activated()), this, SLOT(close()));
278 275
279 helpGeneral=new QAction(tr("General Help"), QPixmap(help_general_xpm), tr("&General"), 0, this); 276 // helpGeneral=new QAction(tr("General Help"), QPixmap(help_general_xpm), tr("&General"), 0, this);
280 connect(helpGeneral, SIGNAL(activated()), this, SLOT(slotHelpGeneral())); 277 //connect(helpGeneral, SIGNAL(activated()), this, SLOT(slotHelpGeneral()));
281 helpAbout=new QAction(tr("About Opie Sheet"), tr("&About"), 0, this); 278 //helpAbout=new QAction(tr("About Opie Sheet"), tr("&About"), 0, this);
282 connect(helpAbout, SIGNAL(activated()), this, SLOT(slotHelpAbout())); 279 //connect(helpAbout, SIGNAL(activated()), this, SLOT(slotHelpAbout()));
283 280
284 editAccept=new QAction(tr("Accept"), QPixmap(edit_accept_xpm), tr("&Accept"), 0, this); 281 editAccept=new QAction(tr("Accept"),Resource::loadPixmap( "enter" ) , tr("&Accept"), 0, this);
285 connect(editAccept, SIGNAL(activated()), this, SLOT(slotEditAccept())); 282 connect(editAccept, SIGNAL(activated()), this, SLOT(slotEditAccept()));
286 editCancel=new QAction(tr("Cancel"), QPixmap(edit_cancel_xpm), tr("&Cancel"), 0, this); 283 editCancel=new QAction(tr("Cancel"), Resource::loadPixmap( "close" ), tr("&Cancel"), 0, this);
287 connect(editCancel, SIGNAL(activated()), this, SLOT(slotEditCancel())); 284 connect(editCancel, SIGNAL(activated()), this, SLOT(slotEditCancel()));
288 editCellSelect=new QAction(tr("Cell Selector"), QPixmap(cell_select_xpm), tr("Cell &Selector"), 0, this); 285 editCellSelect=new QAction(tr("Cell Selector"), QPixmap(cell_select_xpm), tr("Cell &Selector"), 0, this);
289 editCellSelect->setToggleAction(TRUE); 286 editCellSelect->setToggleAction(TRUE);
290 connect(editCellSelect, SIGNAL(toggled(bool)), this, SLOT(slotCellSelect(bool))); 287 connect(editCellSelect, SIGNAL(toggled(bool)), this, SLOT(slotCellSelect(bool)));
291 editCut=new QAction(tr("Cut Cells"), tr("Cu&t"), 0, this); 288 editCut=new QAction(tr("Cut Cells"), tr("Cu&t"), 0, this);
292 editCopy=new QAction(tr("Copy Cells"), tr("&Copy"), 0, this); 289 editCopy=new QAction(tr("Copy Cells"), tr("&Copy"), 0, this);
293 editPaste=new QAction(tr("Paste Cells"), tr("&Paste"), 0, this); 290 editPaste=new QAction(tr("Paste Cells"), tr("&Paste"), 0, this);
294 connect(editPaste, SIGNAL(activated()), this, SLOT(slotEditPaste())); 291 connect(editPaste, SIGNAL(activated()), this, SLOT(slotEditPaste()));
295 editPasteContents=new QAction(tr("Paste Contents"), tr("Paste Cont&ents"), 0, this); 292 editPasteContents=new QAction(tr("Paste Contents"), tr("Paste Cont&ents"), 0, this);
296 connect(editPasteContents, SIGNAL(activated()), this, SLOT(slotEditPasteContents())); 293 connect(editPasteContents, SIGNAL(activated()), this, SLOT(slotEditPasteContents()));
297 editClear=new QAction(tr("Clear Cells"), tr("C&lear"), 0, this); 294 editClear=new QAction(tr("Clear Cells"), tr("C&lear"), 0, this);
298 295
299 insertCells=new QAction(tr("Insert Cells"), tr("C&ells"), 0, this); 296 insertCells=new QAction(tr("Insert Cells"), tr("C&ells"), 0, this);
300 connect(insertCells, SIGNAL(activated()), this, SLOT(slotInsertCells())); 297 connect(insertCells, SIGNAL(activated()), this, SLOT(slotInsertCells()));
301 insertRows=new QAction(tr("Insert Rows"), tr("&Rows"), 0, this); 298 insertRows=new QAction(tr("Insert Rows"), tr("&Rows"), 0, this);
302 connect(insertRows, SIGNAL(activated()), this, SLOT(slotInsertRows())); 299 connect(insertRows, SIGNAL(activated()), this, SLOT(slotInsertRows()));
303 insertCols=new QAction(tr("Insert Columns"), tr("&Columns"), 0, this); 300 insertCols=new QAction(tr("Insert Columns"), tr("&Columns"), 0, this);
304 connect(insertCols, SIGNAL(activated()), this, SLOT(slotInsertCols())); 301 connect(insertCols, SIGNAL(activated()), this, SLOT(slotInsertCols()));
305 insertSheets=new QAction(tr("Add Sheets"), tr("&Sheets"), 0, this); 302 insertSheets=new QAction(tr("Add Sheets"), tr("&Sheets"), 0, this);
306 connect(insertSheets, SIGNAL(activated()), this, SLOT(slotInsertSheets())); 303 connect(insertSheets, SIGNAL(activated()), this, SLOT(slotInsertSheets()));
307 304
308 formatCells=new QAction(tr("Cells"), tr("&Cells"), 0, this); 305 formatCells=new QAction(tr("Cells"), tr("&Cells"), 0, this);
309 connect(formatCells, SIGNAL(activated()), this, SLOT(slotFormatCells())); 306 connect(formatCells, SIGNAL(activated()), this, SLOT(slotFormatCells()));
310 307
311 rowHeight=new QAction(tr("Row Height"), tr("H&eight"), 0, this); 308 rowHeight=new QAction(tr("Row Height"), tr("H&eight"), 0, this);
312 connect(rowHeight, SIGNAL(activated()), this, SLOT(slotRowHeight())); 309 connect(rowHeight, SIGNAL(activated()), this, SLOT(slotRowHeight()));
313 rowAdjust=new QAction(tr("Adjust Row"), tr("&Adjust"), 0, this); 310 rowAdjust=new QAction(tr("Adjust Row"), tr("&Adjust"), 0, this);
314 connect(rowAdjust, SIGNAL(activated()), this, SLOT(slotRowAdjust())); 311 connect(rowAdjust, SIGNAL(activated()), this, SLOT(slotRowAdjust()));
315 rowShow=new QAction(tr("Show Row"), tr("&Show"), 0, this); 312 rowShow=new QAction(tr("Show Row"), tr("&Show"), 0, this);
316 connect(rowShow, SIGNAL(activated()), this, SLOT(slotRowShow())); 313 connect(rowShow, SIGNAL(activated()), this, SLOT(slotRowShow()));
317 rowHide=new QAction(tr("Hide Row"), tr("&Hide"), 0, this); 314 rowHide=new QAction(tr("Hide Row"), tr("&Hide"), 0, this);
318 connect(rowHide, SIGNAL(activated()), this, SLOT(slotRowHide())); 315 connect(rowHide, SIGNAL(activated()), this, SLOT(slotRowHide()));
319 316
320 colWidth=new QAction(tr("Column Width"), tr("&Width"), 0, this); 317 colWidth=new QAction(tr("Column Width"), tr("&Width"), 0, this);
321 connect(colWidth, SIGNAL(activated()), this, SLOT(slotColumnWidth())); 318 connect(colWidth, SIGNAL(activated()), this, SLOT(slotColumnWidth()));
322 colAdjust=new QAction(tr("Adjust Column"), tr("&Adjust"), 0, this); 319 colAdjust=new QAction(tr("Adjust Column"), tr("&Adjust"), 0, this);
323 connect(colAdjust, SIGNAL(activated()), this, SLOT(slotColumnAdjust())); 320 connect(colAdjust, SIGNAL(activated()), this, SLOT(slotColumnAdjust()));
324 colShow=new QAction(tr("Show Column"), tr("&Show"), 0, this); 321 colShow=new QAction(tr("Show Column"), tr("&Show"), 0, this);
325 connect(colShow, SIGNAL(activated()), this, SLOT(slotColumnShow())); 322 connect(colShow, SIGNAL(activated()), this, SLOT(slotColumnShow()));
326 colHide=new QAction(tr("Hide Column"), tr("&Hide"), 0, this); 323 colHide=new QAction(tr("Hide Column"), tr("&Hide"), 0, this);
327 connect(colHide, SIGNAL(activated()), this, SLOT(slotColumnHide())); 324 connect(colHide, SIGNAL(activated()), this, SLOT(slotColumnHide()));
328 325
329 sheetRename=new QAction(tr("Rename Sheet"), tr("&Rename"), 0, this); 326 sheetRename=new QAction(tr("Rename Sheet"), tr("&Rename"), 0, this);
330 connect(sheetRename, SIGNAL(activated()), this, SLOT(slotSheetRename())); 327 connect(sheetRename, SIGNAL(activated()), this, SLOT(slotSheetRename()));
331 sheetRemove=new QAction(tr("Remove Sheet"), tr("R&emove"), 0, this); 328 sheetRemove=new QAction(tr("Remove Sheet"), tr("R&emove"), 0, this);
332 connect(sheetRemove, SIGNAL(activated()), this, SLOT(slotSheetRemove())); 329 connect(sheetRemove, SIGNAL(activated()), this, SLOT(slotSheetRemove()));
333 330
334 dataSort=new QAction(tr("Sort Data"), tr("&Sort"), 0, this); 331 dataSort=new QAction(tr("Sort Data"), tr("&Sort"), 0, this);
335 connect(dataSort, SIGNAL(activated()), this, SLOT(slotDataSort())); 332 connect(dataSort, SIGNAL(activated()), this, SLOT(slotDataSort()));
336 dataFindReplace=new QAction(tr("Find && Replace"), tr("&Find && Replace"), 0, this); 333 dataFindReplace=new QAction(tr("Find && Replace"), tr("&Find && Replace"), 0, this);
337 connect(dataFindReplace, SIGNAL(activated()), this, SLOT(slotDataFindReplace())); 334 connect(dataFindReplace, SIGNAL(activated()), this, SLOT(slotDataFindReplace()));
338 335
339 funcEqual=new QAction(tr("Equal To"), QPixmap(func_equal_xpm), tr("&Equal To"), 0, this); 336 funcEqual=new QAction(tr("Equal To"), QPixmap(func_equal_xpm), tr("&Equal To"), 0, this);
340 funcEqual->setToolTip("="); 337 funcEqual->setToolTip("=");
341 connect(funcEqual, SIGNAL(activated()), this, SLOT(slotFuncOutput())); 338 connect(funcEqual, SIGNAL(activated()), this, SLOT(slotFuncOutput()));
342 funcPlus=new QAction(tr("Addition"), QPixmap(func_plus_xpm), tr("&Addition"), 0, this); 339 funcPlus=new QAction(tr("Addition"), QPixmap(func_plus_xpm), tr("&Addition"), 0, this);
343 funcPlus->setToolTip("+"); 340 funcPlus->setToolTip("+");
344 connect(funcPlus, SIGNAL(activated()), this, SLOT(slotFuncOutput())); 341 connect(funcPlus, SIGNAL(activated()), this, SLOT(slotFuncOutput()));
345 funcMinus=new QAction(tr("Subtraction"), QPixmap(func_minus_xpm), tr("&Subtraction"), 0, this); 342 funcMinus=new QAction(tr("Subtraction"), QPixmap(func_minus_xpm), tr("&Subtraction"), 0, this);
346 funcMinus->setToolTip("-"); 343 funcMinus->setToolTip("-");
347 connect(funcMinus, SIGNAL(activated()), this, SLOT(slotFuncOutput())); 344 connect(funcMinus, SIGNAL(activated()), this, SLOT(slotFuncOutput()));
348 funcCross=new QAction(tr("Multiplication"), QPixmap(func_cross_xpm), tr("&Multiplication"), 0, this); 345 funcCross=new QAction(tr("Multiplication"), QPixmap(func_cross_xpm), tr("&Multiplication"), 0, this);
349 funcCross->setToolTip("*"); 346 funcCross->setToolTip("*");
350 connect(funcCross, SIGNAL(activated()), this, SLOT(slotFuncOutput())); 347 connect(funcCross, SIGNAL(activated()), this, SLOT(slotFuncOutput()));
351 funcDivide=new QAction(tr("Division"), QPixmap(func_divide_xpm), tr("&Division"), 0, this); 348 funcDivide=new QAction(tr("Division"), QPixmap(func_divide_xpm), tr("&Division"), 0, this);
352 funcDivide->setToolTip("/"); 349 funcDivide->setToolTip("/");
353 connect(funcDivide, SIGNAL(activated()), this, SLOT(slotFuncOutput())); 350 connect(funcDivide, SIGNAL(activated()), this, SLOT(slotFuncOutput()));
354 funcParanOpen=new QAction(tr("Open ParanthesistempCellData->row+row1, tempCellData->col+col1"), QPixmap(func_paran_open_xpm), tr("&Open Paranthesis"), 0, this); 351 funcParanOpen=new QAction(tr("Open ParanthesistempCellData->row+row1, tempCellData->col+col1"), QPixmap(func_paran_open_xpm), tr("&Open Paranthesis"), 0, this);
355 funcParanOpen->setToolTip("("); 352 funcParanOpen->setToolTip("(");
356 connect(funcParanOpen, SIGNAL(activated()), this, SLOT(slotFuncOutput())); 353 connect(funcParanOpen, SIGNAL(activated()), this, SLOT(slotFuncOutput()));
357 funcParanClose=new QAction(tr("Close Paranthesis"), QPixmap(func_paran_close_xpm), tr("&Close Paranthesis"), 0, this); 354 funcParanClose=new QAction(tr("Close Paranthesis"), QPixmap(func_paran_close_xpm), tr("&Close Paranthesis"), 0, this);
358 funcParanClose->setToolTip(")"); 355 funcParanClose->setToolTip(")");
359 connect(funcParanClose, SIGNAL(activated()), this, SLOT(slotFuncOutput())); 356 connect(funcParanClose, SIGNAL(activated()), this, SLOT(slotFuncOutput()));
360 funcComma=new QAction(tr("Comma"), QPixmap(func_comma_xpm), tr("&Comma"), 0, this); 357 funcComma=new QAction(tr("Comma"), QPixmap(func_comma_xpm), tr("&Comma"), 0, this);
361 funcComma->setToolTip(","); 358 funcComma->setToolTip(",");
362 connect(funcComma, SIGNAL(activated()), this, SLOT(slotFuncOutput())); 359 connect(funcComma, SIGNAL(activated()), this, SLOT(slotFuncOutput()));
363} 360}
364 361
365void MainWindow::initMenu() 362void MainWindow::initMenu()
366{ 363{
367 menu=new QPEMenuBar(this); 364 menu=new QPEMenuBar(this);
368 365
369 menuFile=new QPopupMenu; 366 menuFile=new QPopupMenu;
370 fileNew->addTo(menuFile); 367 fileNew->addTo(menuFile);
371 fileOpen->addTo(menuFile); 368 fileOpen->addTo(menuFile);
372 fileSave->addTo(menuFile); 369 fileSave->addTo(menuFile);
373 fileSaveAs->addTo(menuFile); 370 fileSaveAs->addTo(menuFile);
374 menuFile->insertSeparator(); 371// menuFile->insertSeparator();
375 fileQuit->addTo(menuFile); 372// fileQuit->addTo(menuFile);
376 menu->insertItem(tr("&File"), menuFile); 373 menu->insertItem(tr("&File"), menuFile);
377 374
378 menuEdit=new QPopupMenu; 375 menuEdit=new QPopupMenu;
379 editAccept->addTo(menuEdit); 376 editAccept->addTo(menuEdit);
380 editCancel->addTo(menuEdit); 377 editCancel->addTo(menuEdit);
381 editCellSelect->addTo(menuEdit); 378 editCellSelect->addTo(menuEdit);
382 menuEdit->insertSeparator(); 379 menuEdit->insertSeparator();
383 editCut->addTo(menuEdit); 380 editCut->addTo(menuEdit);
384 editCopy->addTo(menuEdit); 381 editCopy->addTo(menuEdit);
385 editPaste->addTo(menuEdit); 382 editPaste->addTo(menuEdit);
386 editPasteContents->addTo(menuEdit); 383 editPasteContents->addTo(menuEdit);
387 editClear->addTo(menuEdit); 384 editClear->addTo(menuEdit);
388 menu->insertItem(tr("&Edit"), menuEdit); 385 menu->insertItem(tr("&Edit"), menuEdit);
389 386
390 menuInsert=new QPopupMenu; 387 menuInsert=new QPopupMenu;
391 menu->insertItem(tr("&Insert"), menuInsert); 388 menu->insertItem(tr("&Insert"), menuInsert);
392 389
393 menuFormat=new QPopupMenu; 390 menuFormat=new QPopupMenu;
394 formatCells->addTo(menuFormat); 391 formatCells->addTo(menuFormat);
395 menu->insertItem(tr("&Format"), menuFormat); 392 menu->insertItem(tr("&Format"), menuFormat);
396 393
397 menuData=new QPopupMenu; 394 menuData=new QPopupMenu;
398 dataSort->addTo(menuData); 395 dataSort->addTo(menuData);
399 dataFindReplace->addTo(menuData); 396 dataFindReplace->addTo(menuData);
400 menu->insertItem(tr("&Data"), menuData); 397 menu->insertItem(tr("&Data"), menuData);
401 398
402 menuHelp=new QPopupMenu; 399// menuHelp=new QPopupMenu;
403 helpGeneral->addTo(menuHelp); 400// helpGeneral->addTo(menuHelp);
404 helpAbout->addTo(menuHelp); 401// helpAbout->addTo(menuHelp);
405 menu->insertItem(tr("&Help"), menuHelp); 402// menu->insertItem(tr("&Help"), menuHelp);
406 403
407 submenuRow=new QPopupMenu; 404 submenuRow=new QPopupMenu;
408 rowHeight->addTo(submenuRow); 405 rowHeight->addTo(submenuRow);
409 rowAdjust->addTo(submenuRow); 406 rowAdjust->addTo(submenuRow);
410 rowShow->addTo(submenuRow); 407 rowShow->addTo(submenuRow);
411 rowHide->addTo(submenuRow); 408 rowHide->addTo(submenuRow);
412 menuFormat->insertItem(tr("&Row"), submenuRow); 409 menuFormat->insertItem(tr("&Row"), submenuRow);
413 410
414 submenuCol=new QPopupMenu; 411 submenuCol=new QPopupMenu;
415 colWidth->addTo(submenuCol); 412 colWidth->addTo(submenuCol);
416 colAdjust->addTo(submenuCol); 413 colAdjust->addTo(submenuCol);
417 colShow->addTo(submenuCol); 414 colShow->addTo(submenuCol);
418 colHide->addTo(submenuCol); 415 colHide->addTo(submenuCol);
419 menuFormat->insertItem(tr("Colum&n"), submenuCol); 416 menuFormat->insertItem(tr("Colum&n"), submenuCol);
420 417
421 submenuSheet=new QPopupMenu; 418 submenuSheet=new QPopupMenu;
422 sheetRename->addTo(submenuSheet); 419 sheetRename->addTo(submenuSheet);
423 sheetRemove->addTo(submenuSheet); 420 sheetRemove->addTo(submenuSheet);
424 menuFormat->insertItem(tr("&Sheet"), submenuSheet); 421 menuFormat->insertItem(tr("&Sheet"), submenuSheet);
425 422
426 submenuFunc=new QPopupMenu; 423 submenuFunc=new QPopupMenu;
427 menuInsert->insertItem(tr("&Function"), submenuFunc); 424 menuInsert->insertItem(tr("&Function"), submenuFunc);
428 425
429 submenuFuncStd=new QPopupMenu; 426 submenuFuncStd=new QPopupMenu;
430 funcPlus->addTo(submenuFuncStd); 427 funcPlus->addTo(submenuFuncStd);
431 funcMinus->addTo(submenuFuncStd); 428 funcMinus->addTo(submenuFuncStd);
432 funcCross->addTo(submenuFuncStd); 429 funcCross->addTo(submenuFuncStd);
433 funcDivide->addTo(submenuFuncStd); 430 funcDivide->addTo(submenuFuncStd);
434 submenuFunc->insertItem(tr("&Standard"), submenuFuncStd); 431 submenuFunc->insertItem(tr("&Standard"), submenuFuncStd);
435 432
436 submenuFuncMath=new QPopupMenu; 433 submenuFuncMath=new QPopupMenu;
437 addFlyAction(tr("Summation"), tr("&Summation"), "SUM(", submenuFuncMath); 434 addFlyAction(tr("Summation"), tr("&Summation"), "SUM(", submenuFuncMath);
438 addFlyAction(tr("Absolute Value"), tr("&Absolute"), "ABS(", submenuFuncMath); 435 addFlyAction(tr("Absolute Value"), tr("&Absolute"), "ABS(", submenuFuncMath);
439 submenuFuncMath->insertSeparator(); 436 submenuFuncMath->insertSeparator();
440 addFlyAction(tr("Sine"), tr("Si&ne"), "SIN(", submenuFuncMath); 437 addFlyAction(tr("Sine"), tr("Si&ne"), "SIN(", submenuFuncMath);
441 addFlyAction(tr("Arc Sine"), tr("A&rc Sine"), "ASIN(", submenuFuncMath); 438 addFlyAction(tr("Arc Sine"), tr("A&rc Sine"), "ASIN(", submenuFuncMath);
442 addFlyAction(tr("Cosine"), tr("&Cosine"), "COS(", submenuFuncMath); 439 addFlyAction(tr("Cosine"), tr("&Cosine"), "COS(", submenuFuncMath);
443 addFlyAction(tr("ArcCosine"), tr("Arc Cos&ine"), "COS(", submenuFuncMath); 440 addFlyAction(tr("ArcCosine"), tr("Arc Cos&ine"), "COS(", submenuFuncMath);
444 addFlyAction(tr("Tangent"), tr("&Tangent"), "TAN(", submenuFuncMath); 441 addFlyAction(tr("Tangent"), tr("&Tangent"), "TAN(", submenuFuncMath);
445 addFlyAction(tr("Arc Tangent"), tr("Arc Tan&gent"), "ATAN(", submenuFuncMath); 442 addFlyAction(tr("Arc Tangent"), tr("Arc Tan&gent"), "ATAN(", submenuFuncMath);
446 addFlyAction(tr("Arc Tangent of Coordinates"), tr("C&oor. Arc Tangent"), "ATAN2(", submenuFuncMath); 443 addFlyAction(tr("Arc Tangent of Coordinates"), tr("C&oor. Arc Tangent"), "ATAN2(", submenuFuncMath);
447 submenuFuncMath->insertSeparator(); 444 submenuFuncMath->insertSeparator();
448 addFlyAction(tr("Exponential"), tr("&Exponential"), "EXP(", submenuFuncMath); 445 addFlyAction(tr("Exponential"), tr("&Exponential"), "EXP(", submenuFuncMath);
449 addFlyAction(tr("Logarithm"), tr("&Logarithm"), "LOG(", submenuFuncMath); 446 addFlyAction(tr("Logarithm"), tr("&Logarithm"), "LOG(", submenuFuncMath);
450 addFlyAction(tr("Power"), tr("&Power"), "POW(", submenuFuncMath); 447 addFlyAction(tr("Power"), tr("&Power"), "POW(", submenuFuncMath);
451 submenuFunc->insertItem(tr("&Mathematical"), submenuFuncMath); 448 submenuFunc->insertItem(tr("&Mathematical"), submenuFuncMath);
452 449
453 submenuFuncStat=new QPopupMenu; 450 submenuFuncStat=new QPopupMenu;
454 addFlyAction(tr("Average"), tr("&Average"), "AVG(", submenuFuncStat); 451 addFlyAction(tr("Average"), tr("&Average"), "AVG(", submenuFuncStat);
455 addFlyAction(tr("Maximum"), tr("Ma&ximum"), "MAX(", submenuFuncStat); 452 addFlyAction(tr("Maximum"), tr("Ma&ximum"), "MAX(", submenuFuncStat);
456 addFlyAction(tr("Minimum"), tr("&Minimum"), "MIN(", submenuFuncStat); 453 addFlyAction(tr("Minimum"), tr("&Minimum"), "MIN(", submenuFuncStat);
457 addFlyAction(tr("Count"), tr("&Count"), "COUNT(", submenuFuncStat); 454 addFlyAction(tr("Count"), tr("&Count"), "COUNT(", submenuFuncStat);
458 submenuFunc->insertItem(tr("&Statistical"), submenuFuncStat); 455 submenuFunc->insertItem(tr("&Statistical"), submenuFuncStat);
459 456
460 menuInsert->insertSeparator(); 457 menuInsert->insertSeparator();
461 insertCells->addTo(menuInsert); 458 insertCells->addTo(menuInsert);
462 insertRows->addTo(menuInsert); 459 insertRows->addTo(menuInsert);
463 insertCols->addTo(menuInsert); 460 insertCols->addTo(menuInsert);
464 insertSheets->addTo(menuInsert); 461 insertSheets->addTo(menuInsert);
465} 462}
466 463
467void MainWindow::initStandardToolbar() 464void MainWindow::initStandardToolbar()
468{ 465{
469 toolbarStandard=new QPEToolBar(this); 466 toolbarStandard=new QPEToolBar(this);
470 toolbarStandard->setHorizontalStretchable(TRUE); 467 toolbarStandard->setHorizontalStretchable(TRUE);
471 moveToolBar(toolbarStandard, Top); 468 moveToolBar(toolbarStandard, Top);
472 469
473 fileNew->addTo(toolbarStandard); 470 fileNew->addTo(toolbarStandard);
474 fileOpen->addTo(toolbarStandard); 471 fileOpen->addTo(toolbarStandard);
475 fileSave->addTo(toolbarStandard); 472 fileSave->addTo(toolbarStandard);
476 473
477 comboSheets=new QComboBox(toolbarStandard); 474 comboSheets=new QComboBox(toolbarStandard);
478 toolbarStandard->setStretchableWidget(comboSheets); 475 toolbarStandard->setStretchableWidget(comboSheets);
479 connect(comboSheets, SIGNAL(activated(const QString &)), this, SLOT(slotSheetChanged(const QString &))); 476 connect(comboSheets, SIGNAL(activated(const QString &)), this, SLOT(slotSheetChanged(const QString &)));
480} 477}
481 478
482void MainWindow::initFunctionsToolbar() 479void MainWindow::initFunctionsToolbar()
483{ 480{
484 toolbarFunctions=new QPEToolBar(this); 481 toolbarFunctions=new QPEToolBar(this);
485 toolbarFunctions->setHorizontalStretchable(TRUE); 482 toolbarFunctions->setHorizontalStretchable(TRUE);
486 moveToolBar(toolbarFunctions, Bottom); 483 moveToolBar(toolbarFunctions, Bottom);
487 484
488 funcEqual->addTo(toolbarFunctions); 485 funcEqual->addTo(toolbarFunctions);
489 funcPlus->addTo(toolbarFunctions); 486 funcPlus->addTo(toolbarFunctions);
490 funcMinus->addTo(toolbarFunctions); 487 funcMinus->addTo(toolbarFunctions);
491 funcCross->addTo(toolbarFunctions); 488 funcCross->addTo(toolbarFunctions);
492 funcDivide->addTo(toolbarFunctions); 489 funcDivide->addTo(toolbarFunctions);
493 funcParanOpen->addTo(toolbarFunctions); 490 funcParanOpen->addTo(toolbarFunctions);
494 funcParanClose->addTo(toolbarFunctions); 491 funcParanClose->addTo(toolbarFunctions);
495 funcComma->addTo(toolbarFunctions); 492 funcComma->addTo(toolbarFunctions);
496 493
497 toolFunction=new QToolButton(toolbarFunctions); 494 toolFunction=new QToolButton(toolbarFunctions);
498 toolFunction->setPixmap(func_func_xpm); 495 toolFunction->setPixmap(func_func_xpm);
499 toolFunction->setTextLabel(tr("Functions")); 496 toolFunction->setTextLabel(tr("Functions"));
500 toolFunction->setPopup(submenuFunc); 497 toolFunction->setPopup(submenuFunc);
501 toolFunction->setPopupDelay(0); 498 toolFunction->setPopupDelay(0);
502} 499}
503 500
504void MainWindow::initEditToolbar() 501void MainWindow::initEditToolbar()
505{ 502{
506 toolbarEdit=new QPEToolBar(this); 503 toolbarEdit=new QPEToolBar(this);
507 toolbarEdit->setHorizontalStretchable(TRUE); 504 toolbarEdit->setHorizontalStretchable(TRUE);
508 moveToolBar(toolbarEdit, Bottom); 505 moveToolBar(toolbarEdit, Bottom);
509 506
510 editAccept->addTo(toolbarEdit); 507 editAccept->addTo(toolbarEdit);
511 editCancel->addTo(toolbarEdit); 508 editCancel->addTo(toolbarEdit);
512 509
513 editData=new QLineEdit(toolbarEdit); 510 editData=new QLineEdit(toolbarEdit);
514 toolbarEdit->setStretchableWidget(editData); 511 toolbarEdit->setStretchableWidget(editData);
515 connect(editData, SIGNAL(returnPressed()), this, SLOT(slotEditAccept())); 512 connect(editData, SIGNAL(returnPressed()), this, SLOT(slotEditAccept()));
516 513
517 editCellSelect->addTo(toolbarEdit); 514 editCellSelect->addTo(toolbarEdit);
518} 515}
519 516
520void MainWindow::slotHelpGeneral()
521{
522 if (QFile::exists(helpFile))
523 {
524 QCopEnvelope e("QPE/Application/helpbrowser", "showFile(QString)");
525 e << helpFile;
526 }
527 else
528 QMessageBox::critical(this, tr("Error"), tr("Help file not found!"));
529}
530
531void MainWindow::slotHelpAbout() 517void MainWindow::slotHelpAbout()
532{ 518{
533 QDialog dialogAbout(this, 0, TRUE); 519 QDialog dialogAbout(this, 0, TRUE);
534 dialogAbout.resize(width()-40, height()-80); 520 dialogAbout.resize(width()-40, height()-80);
535 dialogAbout.setCaption(tr("About Opie Sheet")); 521 dialogAbout.setCaption(tr("About Opie Sheet"));
536 522
537 QLabel label(tr("Opie Sheet\nSpreadsheet Software for Opie\nQWDC Beta Winner (as Sheet/Qt)\n\nDeveloped by: Serdar Ozler\nRelease 1.0.2\nRelease Date: October 08, 2002\n\nThis product is licensed under GPL. It is freely distributable. If you want to get the latest version and also the source code, please visit the web site.\n\nhttp://qtopia.sitebest.com"), &dialogAbout); 523 QLabel label(tr("Opie Sheet\nSpreadsheet Software for Opie\nQWDC Beta Winner (as Sheet/Qt)\n\nDeveloped by: Serdar Ozler\nRelease 1.0.2\nRelease Date: October 08, 2002\n\nThis product is licensed under GPL. It is freely distributable. If you want to get the latest version and also the source code, please visit the web site.\n\nhttp://qtopia.sitebest.com"), &dialogAbout);
538 label.setGeometry(dialogAbout.rect()); 524 label.setGeometry(dialogAbout.rect());
539 label.setAlignment(Qt::AlignCenter | Qt::WordBreak); 525 label.setAlignment(Qt::AlignCenter | Qt::WordBreak);
540 526
541 dialogAbout.exec(); 527 dialogAbout.exec();
542} 528}
543 529
544void MainWindow::initSheet() 530void MainWindow::initSheet()
545{ 531{
546 sheet=new Sheet(DEFAULT_NUM_ROWS, DEFAULT_NUM_COLS, this); 532 sheet=new Sheet(DEFAULT_NUM_ROWS, DEFAULT_NUM_COLS, this);
547 setCentralWidget(sheet); 533 setCentralWidget(sheet);
548 534
549 connect(sheet, SIGNAL(currentDataChanged(const QString &)), editData, SLOT(setText(const QString &))); 535 connect(sheet, SIGNAL(currentDataChanged(const QString &)), editData, SLOT(setText(const QString &)));
550 connect(sheet, SIGNAL(cellClicked(const QString &)), this, SLOT(slotCellClicked(const QString &))); 536 connect(sheet, SIGNAL(cellClicked(const QString &)), this, SLOT(slotCellClicked(const QString &)));
551 connect(sheet, SIGNAL(sheetModified()), this, SLOT(slotDocModified())); 537 connect(sheet, SIGNAL(sheetModified()), this, SLOT(slotDocModified()));
552 538
553 connect(editCut, SIGNAL(activated()), sheet, SLOT(editCut())); 539 connect(editCut, SIGNAL(activated()), sheet, SLOT(editCut()));
554 connect(editCopy, SIGNAL(activated()), sheet, SLOT(editCopy())); 540 connect(editCopy, SIGNAL(activated()), sheet, SLOT(editCopy()));
555 connect(editClear, SIGNAL(activated()), sheet, SLOT(editClear())); 541 connect(editClear, SIGNAL(activated()), sheet, SLOT(editClear()));
556} 542}
557 543
558void MainWindow::slotEditAccept() 544void MainWindow::slotEditAccept()
559{ 545{
560 sheet->setData(editData->text()); 546 sheet->setData(editData->text());
561} 547}
562 548
563void MainWindow::slotEditCancel() 549void MainWindow::slotEditCancel()
564{ 550{
565 editData->setText(sheet->getData()); 551 editData->setText(sheet->getData());
566} 552}
567 553
568void MainWindow::slotCellSelect(bool lock) 554void MainWindow::slotCellSelect(bool lock)
569{ 555{
570 sheet->lockClicks(lock); 556 sheet->lockClicks(lock);
571} 557}
572 558
573void MainWindow::addToData(const QString &data) 559void MainWindow::addToData(const QString &data)
574{ 560{
575 editData->setText(editData->text().insert(editData->cursorPosition(), data)); 561 editData->setText(editData->text().insert(editData->cursorPosition(), data));
576} 562}
577 563
578void MainWindow::slotFuncOutput() 564void MainWindow::slotFuncOutput()
579{ 565{
580 if (sender()->isA("QAction")) 566 if (sender()->isA("QAction"))
581 addToData(((QAction *)sender())->toolTip()); 567 addToData(((QAction *)sender())->toolTip());
582} 568}
583 569
584void MainWindow::slotInsertRows() 570void MainWindow::slotInsertRows()
585{ 571{
586 NumberDialog dialogNumber(this); 572 NumberDialog dialogNumber(this);
587 if (dialogNumber.exec(tr("Insert Rows"), tr("&Number of rows:"))==QDialog::Accepted) 573 if (dialogNumber.exec(tr("Insert Rows"), tr("&Number of rows:"))==QDialog::Accepted)
588 sheet->insertRows(dialogNumber.getValue()); 574 sheet->insertRows(dialogNumber.getValue());
589} 575}
590 576
591void MainWindow::slotInsertCols() 577void MainWindow::slotInsertCols()
592{ 578{
593 NumberDialog dialogNumber(this); 579 NumberDialog dialogNumber(this);
594 if (dialogNumber.exec(tr("Insert Columns"), tr("&Number of columns:"))==QDialog::Accepted) 580 if (dialogNumber.exec(tr("Insert Columns"), tr("&Number of columns:"))==QDialog::Accepted)
595 sheet->insertColumns(dialogNumber.getValue()); 581 sheet->insertColumns(dialogNumber.getValue());
596} 582}
597 583
598void MainWindow::slotInsertSheets() 584void MainWindow::slotInsertSheets()
599{ 585{
600 NumberDialog dialogNumber(this); 586 NumberDialog dialogNumber(this);
601 if (dialogNumber.exec(tr("Add Sheets"), tr("&Number of sheets:"))==QDialog::Accepted) 587 if (dialogNumber.exec(tr("Add Sheets"), tr("&Number of sheets:"))==QDialog::Accepted)
602 for (int i=dialogNumber.getValue(); i>0; --i) createNewSheet(); 588 for (int i=dialogNumber.getValue(); i>0; --i) createNewSheet();
603} 589}
604 590
605void MainWindow::slotCellClicked(const QString &cell) 591void MainWindow::slotCellClicked(const QString &cell)
606{ 592{
607 editCellSelect->setOn(FALSE); 593 editCellSelect->setOn(FALSE);
608 addToData(cell); 594 addToData(cell);
609} 595}
610 596
611typeSheet *MainWindow::createNewSheet() 597typeSheet *MainWindow::createNewSheet()
612{ 598{
613 typeSheet *newSheet=new typeSheet; 599 typeSheet *newSheet=new typeSheet;
614 int currentNo=1, tempNo; 600 int currentNo=1, tempNo;
615 bool ok; 601 bool ok;
616 602
617 for (typeSheet *tempSheet=listSheets.first(); tempSheet; tempSheet=listSheets.next()) 603 for (typeSheet *tempSheet=listSheets.first(); tempSheet; tempSheet=listSheets.next())
618 if (tempSheet->name.startsWith(tr("Sheet")) && (tempNo=tempSheet->name.mid(tr("Sheet").length()).toInt(&ok))>=currentNo && ok) 604 if (tempSheet->name.startsWith(tr("Sheet")) && (tempNo=tempSheet->name.mid(tr("Sheet").length()).toInt(&ok))>=currentNo && ok)
619 currentNo=tempNo+1; 605 currentNo=tempNo+1;
620 606
621 newSheet->name=tr("Sheet")+QString::number(currentNo); 607 newSheet->name=tr("Sheet")+QString::number(currentNo);
622 newSheet->data.setAutoDelete(TRUE); 608 newSheet->data.setAutoDelete(TRUE);
623 609
624 comboSheets->insertItem(newSheet->name); 610 comboSheets->insertItem(newSheet->name);
625 listSheets.append(newSheet); 611 listSheets.append(newSheet);
626 return newSheet; 612 return newSheet;
diff --git a/noncore/apps/opie-sheet/mainwindow.h b/noncore/apps/opie-sheet/mainwindow.h
index d68e25c..10d6650 100644
--- a/noncore/apps/opie-sheet/mainwindow.h
+++ b/noncore/apps/opie-sheet/mainwindow.h
@@ -1,133 +1,132 @@
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#ifndef MAINWINDOW_H 15#ifndef MAINWINDOW_H
16#define MAINWINDOW_H 16#define MAINWINDOW_H
17 17
18#include <qpe/applnk.h> 18#include <qpe/applnk.h>
19#include <qpe/fileselector.h> 19#include <qpe/fileselector.h>
20#include <qpe/qpemenubar.h> 20#include <qpe/qpemenubar.h>
21#include <qpe/qpetoolbar.h> 21#include <qpe/qpetoolbar.h>
22#include <qmainwindow.h> 22#include <qmainwindow.h>
23#include <qaction.h> 23#include <qaction.h>
24#include <qlineedit.h> 24#include <qlineedit.h>
25#include <qbutton.h> 25#include <qbutton.h>
26#include <qcombobox.h> 26#include <qcombobox.h>
27#include <qtoolbutton.h> 27#include <qtoolbutton.h>
28 28
29#include "sheet.h" 29#include "sheet.h"
30 30
31typedef struct typeSheet 31typedef struct typeSheet
32{ 32{
33 QString name; 33 QString name;
34 QList<typeCellData> data; 34 QList<typeCellData> data;
35}; 35};
36 36
37class MainWindow: public QMainWindow 37class MainWindow: public QMainWindow
38{ 38{
39 Q_OBJECT 39 Q_OBJECT
40 40
41 // QPE objects 41 // QPE objects
42 DocLnk* currentDoc; 42 DocLnk* currentDoc;
43 QPEMenuBar *menu; 43 QPEMenuBar *menu;
44 QPEToolBar *toolbarFunctions, *toolbarEdit, *toolbarStandard; 44 QPEToolBar *toolbarFunctions, *toolbarEdit, *toolbarStandard;
45 FileSelector *fileSelector; 45 FileSelector *fileSelector;
46 46
47 // QT objects 47 // QT objects
48 QPopupMenu *menuFile, *menuEdit, *menuInsert, *menuFormat, *menuData, *menuHelp, 48 QPopupMenu *menuFile, *menuEdit, *menuInsert, *menuFormat, *menuData, *menuHelp,
49 *submenuFunc, *submenuFuncStd, *submenuFuncMath, *submenuFuncStat, 49 *submenuFunc, *submenuFuncStd, *submenuFuncMath, *submenuFuncStat,
50 *submenuRow, *submenuCol, *submenuSheet; 50 *submenuRow, *submenuCol, *submenuSheet;
51 QAction *fileNew, *fileOpen, *fileSave, *fileSaveAs, *fileQuit, *helpAbout, *editAccept, *editCancel, *formatCells, 51 QAction *fileNew, *fileOpen, *fileSave, *fileSaveAs, *fileQuit, *helpAbout, *editAccept, *editCancel, *formatCells,
52 *funcPlus, *funcMinus, *funcCross, *funcDivide, *funcParanOpen, *funcParanClose, *funcComma, *funcEqual, 52 *funcPlus, *funcMinus, *funcCross, *funcDivide, *funcParanOpen, *funcParanClose, *funcComma, *funcEqual,
53 *editCut, *editCopy, *editPaste, *editPasteContents, *editClear, *insertCols, *insertRows, *insertSheets, *insertCells, 53 *editCut, *editCopy, *editPaste, *editPasteContents, *editClear, *insertCols, *insertRows, *insertSheets, *insertCells,
54 *rowHeight, *rowShow, *rowHide, *rowAdjust, *colWidth, *colShow, *colHide, *colAdjust, *sheetRename, *sheetRemove, 54 *rowHeight, *rowShow, *rowHide, *rowAdjust, *colWidth, *colShow, *colHide, *colAdjust, *sheetRename, *sheetRemove,
55 *dataSort, *dataFindReplace, *editCellSelect, *helpGeneral; 55 *dataSort, *dataFindReplace, *editCellSelect, *helpGeneral;
56 QLineEdit *editData; 56 QLineEdit *editData;
57 QButton *buttonUp, *buttonDown, *buttonLeft, *buttonRight; 57 QButton *buttonUp, *buttonDown, *buttonLeft, *buttonRight;
58 QComboBox *comboSheets; 58 QComboBox *comboSheets;
59 QToolButton *toolFunction; 59 QToolButton *toolFunction;
60 QList<typeSheet> listSheets; 60 QList<typeSheet> listSheets;
61 QString helpFile; 61 QString helpFile;
62 62
63 // Other objects 63 // Other objects
64 Sheet *sheet; 64 Sheet *sheet;
65 65
66 // Variables 66 // Variables
67 bool documentModified; 67 bool documentModified;
68 68
69 // Private functions 69 // Private functions
70 void initMenu(); 70 void initMenu();
71 void initActions(); 71 void initActions();
72 void initFunctionsToolbar(); 72 void initFunctionsToolbar();
73 void initEditToolbar(); 73 void initEditToolbar();
74 void initStandardToolbar(); 74 void initStandardToolbar();
75 void initSheet(); 75 void initSheet();
76 void addToData(const QString &data); 76 void addToData(const QString &data);
77 int saveCurrentFile(bool ask=TRUE); 77 int saveCurrentFile(bool ask=TRUE);
78 void documentOpen(const DocLnk &lnkDoc); 78 void documentOpen(const DocLnk &lnkDoc);
79 void documentSave(DocLnk *lnkDoc); 79 void documentSave(DocLnk *lnkDoc);
80 void closeEvent(QCloseEvent *e); 80 void closeEvent(QCloseEvent *e);
81 void addFlyAction(const QString &text, const QString &menuText, const QString &tip, QWidget *w); 81 void addFlyAction(const QString &text, const QString &menuText, const QString &tip, QWidget *w);
82 typeSheet *createNewSheet(); 82 typeSheet *createNewSheet();
83 typeSheet *findSheet(const QString &name); 83 typeSheet *findSheet(const QString &name);
84 84
85 private slots: 85 private slots:
86 void slotFileNew(); 86 void slotFileNew();
87 void slotFileOpen(); 87 void slotFileOpen();
88 void slotFileSave(); 88 void slotFileSave();
89 void slotFileSaveAs(); 89 void slotFileSaveAs();
90 void slotHelpAbout(); 90 void slotHelpAbout();
91 void slotHelpGeneral();
92 void slotEditAccept(); 91 void slotEditAccept();
93 void slotEditCancel(); 92 void slotEditCancel();
94 void slotEditPaste(); 93 void slotEditPaste();
95 void slotEditPasteContents(); 94 void slotEditPasteContents();
96 void slotFormatCells(); 95 void slotFormatCells();
97 void slotInsertCells(); 96 void slotInsertCells();
98 void slotInsertRows(); 97 void slotInsertRows();
99 void slotInsertCols(); 98 void slotInsertCols();
100 void slotInsertSheets(); 99 void slotInsertSheets();
101 void slotDataSort(); 100 void slotDataSort();
102 void slotDataFindReplace(); 101 void slotDataFindReplace();
103 void slotRowHeight(); 102 void slotRowHeight();
104 void slotRowAdjust(); 103 void slotRowAdjust();
105 void slotRowShow(); 104 void slotRowShow();
106 void slotRowHide(); 105 void slotRowHide();
107 void slotColumnWidth(); 106 void slotColumnWidth();
108 void slotColumnAdjust(); 107 void slotColumnAdjust();
109 void slotColumnShow(); 108 void slotColumnShow();
110 void slotColumnHide(); 109 void slotColumnHide();
111 void slotSheetRename(); 110 void slotSheetRename();
112 void slotSheetRemove(); 111 void slotSheetRemove();
113 void slotFuncOutput(); 112 void slotFuncOutput();
114 void slotCellSelect(bool lock); 113 void slotCellSelect(bool lock);
115 void slotCellClicked(const QString &cell); 114 void slotCellClicked(const QString &cell);
116 void slotSheetChanged(const QString &name); 115 void slotSheetChanged(const QString &name);
117 void slotDocModified(); 116 void slotDocModified();
118 void selectorShow(); 117 void selectorShow();
119 void selectorHide(); 118 void selectorHide();
120 void selectorFileNew(const DocLnk &lnkDoc); 119 void selectorFileNew(const DocLnk &lnkDoc);
121 void selectorFileOpen(const DocLnk &lnkDoc); 120 void selectorFileOpen(const DocLnk &lnkDoc);
122 121
123 public: 122 public:
124 MainWindow(); 123 MainWindow();
125 ~MainWindow(); 124 ~MainWindow();
126 125
127 void setHelpFile(const QString &help_filename) { helpFile=help_filename; } 126 void setHelpFile(const QString &help_filename) { helpFile=help_filename; }
128 127
129 public slots: 128 public slots:
130 void setDocument(const QString &applnk_filename); 129 void setDocument(const QString &applnk_filename);
131}; 130};
132 131
133#endif 132#endif