summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-sheet/mainwindow.cpp
Unidiff
Diffstat (limited to 'noncore/apps/opie-sheet/mainwindow.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/opie-sheet/mainwindow.cpp35
1 files changed, 11 insertions, 24 deletions
diff --git a/noncore/apps/opie-sheet/mainwindow.cpp b/noncore/apps/opie-sheet/mainwindow.cpp
index a725e31..d47a570 100644
--- a/noncore/apps/opie-sheet/mainwindow.cpp
+++ b/noncore/apps/opie-sheet/mainwindow.cpp
@@ -18,37 +18,24 @@
18#include <qpe/qcopenvelope_qws.h> 18#include <qpe/qcopenvelope_qws.h>
19#include <qpe/resource.h> 19#include <qpe/resource.h>
20#include <qmessagebox.h> 20#include <qmessagebox.h>
21#include <qfile.h> 21#include <qfile.h>
22#include <qtranslator.h> 22#include <qtranslator.h>
23#include <qradiobutton.h> 23#include <qradiobutton.h>
24#include "cellformat.h" 24#include "cellformat.h"
25#include "numberdlg.h" 25#include "numberdlg.h"
26#include "textdlg.h" 26#include "textdlg.h"
27#include "sortdlg.h" 27#include "sortdlg.h"
28#include "finddlg.h" 28#include "finddlg.h"
29 29
30
31#include "func-plus.xpm"
32#include "func-minus.xpm"
33#include "func-cross.xpm"
34#include "func-divide.xpm"
35#include "func-paran-open.xpm"
36#include "func-paran-close.xpm"
37#include "func-comma.xpm"
38#include "func-func.xpm"
39#include "func-equal.xpm"
40#include "cell-select.xpm"
41#include "excel16.xpm"
42
43#define DEFAULT_NUM_ROWS 300 30#define DEFAULT_NUM_ROWS 300
44#define DEFAULT_NUM_COLS (26*3) 31#define DEFAULT_NUM_COLS (26*3)
45#define DEFAULT_NUM_SHEETS 3 32#define DEFAULT_NUM_SHEETS 3
46 33
47MainWindow::MainWindow(QWidget *parent, const char* n, WFlags fl) 34MainWindow::MainWindow(QWidget *parent, const char* n, WFlags fl)
48 :QMainWindow(parent, n, fl) 35 :QMainWindow(parent, n, fl)
49{ 36{
50 // initialize variables 37 // initialize variables
51 documentModified=FALSE; 38 documentModified=FALSE;
52 39
53 // construct objects 40 // construct objects
54 currentDoc=0; 41 currentDoc=0;
@@ -284,37 +271,37 @@ void MainWindow::initActions()
284{ 271{
285 fileNew=new QAction(tr("New File"), Resource::loadPixmap( "new" ), tr("&New"), 0, this); 272 fileNew=new QAction(tr("New File"), Resource::loadPixmap( "new" ), tr("&New"), 0, this);
286 connect(fileNew, SIGNAL(activated()), this, SLOT(slotFileNew())); 273 connect(fileNew, SIGNAL(activated()), this, SLOT(slotFileNew()));
287 fileOpen=new QAction(tr("Open File"), Resource::loadPixmap( "fileopen" ), tr("&Open"), 0, this); 274 fileOpen=new QAction(tr("Open File"), Resource::loadPixmap( "fileopen" ), tr("&Open"), 0, this);
288 connect(fileOpen, SIGNAL(activated()), this, SLOT(slotFileOpen())); 275 connect(fileOpen, SIGNAL(activated()), this, SLOT(slotFileOpen()));
289 fileSave=new QAction(tr("Save File"),Resource::loadPixmap( "save" ), tr("&Save"), 0, this); 276 fileSave=new QAction(tr("Save File"),Resource::loadPixmap( "save" ), tr("&Save"), 0, this);
290 connect(fileSave, SIGNAL(activated()), this, SLOT(slotFileSave())); 277 connect(fileSave, SIGNAL(activated()), this, SLOT(slotFileSave()));
291 fileSaveAs=new QAction(tr("Save File As"), Resource::loadPixmap( "save" ), tr("Save &As"), 0, this); 278 fileSaveAs=new QAction(tr("Save File As"), Resource::loadPixmap( "save" ), tr("Save &As"), 0, this);
292 connect(fileSaveAs, SIGNAL(activated()), this, SLOT(slotFileSaveAs())); 279 connect(fileSaveAs, SIGNAL(activated()), this, SLOT(slotFileSaveAs()));
293 280
294 //fileQuit=new QAction(tr("Quit"), tr("&Quit"), 0, this); 281 //fileQuit=new QAction(tr("Quit"), tr("&Quit"), 0, this);
295 //connect(fileQuit, SIGNAL(activated()), this, SLOT(close())); 282 //connect(fileQuit, SIGNAL(activated()), this, SLOT(close()));
296 fileExcelImport=new QAction(tr("Import Excel file"),QPixmap(excel16_xpm),tr("Import E&xcel file"),0,this); 283 fileExcelImport=new QAction(tr("Import Excel file"),Resource::loadPixmap( "/opie-sheet/excel16" ),tr("Import E&xcel file"),0,this);
297 connect(fileExcelImport, SIGNAL(activated()), this, SLOT(slotImportExcelOpen())); 284 connect(fileExcelImport, SIGNAL(activated()), this, SLOT(slotImportExcelOpen()));
298 285
299 // helpGeneral=new QAction(tr("General Help"), QPixmap(help_general_xpm), tr("&General"), 0, this); 286 // helpGeneral=new QAction(tr("General Help"), QPixmap(help_general_xpm), tr("&General"), 0, this);
300 //connect(helpGeneral, SIGNAL(activated()), this, SLOT(slotHelpGeneral())); 287 //connect(helpGeneral, SIGNAL(activated()), this, SLOT(slotHelpGeneral()));
301 //helpAbout=new QAction(tr("About Opie Sheet"), tr("&About"), 0, this); 288 //helpAbout=new QAction(tr("About Opie Sheet"), tr("&About"), 0, this);
302 //connect(helpAbout, SIGNAL(activated()), this, SLOT(slotHelpAbout())); 289 //connect(helpAbout, SIGNAL(activated()), this, SLOT(slotHelpAbout()));
303 290
304 editAccept=new QAction(tr("Accept"),Resource::loadPixmap( "enter" ) , tr("&Accept"), 0, this); 291 editAccept=new QAction(tr("Accept"),Resource::loadPixmap( "enter" ) , tr("&Accept"), 0, this);
305 connect(editAccept, SIGNAL(activated()), this, SLOT(slotEditAccept())); 292 connect(editAccept, SIGNAL(activated()), this, SLOT(slotEditAccept()));
306 editCancel=new QAction(tr("Cancel"), Resource::loadPixmap( "close" ), tr("&Cancel"), 0, this); 293 editCancel=new QAction(tr("Cancel"), Resource::loadPixmap( "close" ), tr("&Cancel"), 0, this);
307 connect(editCancel, SIGNAL(activated()), this, SLOT(slotEditCancel())); 294 connect(editCancel, SIGNAL(activated()), this, SLOT(slotEditCancel()));
308 editCellSelect=new QAction(tr("Cell Selector"), QPixmap(cell_select_xpm), tr("Cell &Selector"), 0, this); 295 editCellSelect=new QAction(tr("Cell Selector"), Resource::loadPixmap( "opie-sheet/cell_select" ), tr("Cell &Selector"), 0, this);
309 editCellSelect->setToggleAction(TRUE); 296 editCellSelect->setToggleAction(TRUE);
310 connect(editCellSelect, SIGNAL(toggled(bool)), this, SLOT(slotCellSelect(bool))); 297 connect(editCellSelect, SIGNAL(toggled(bool)), this, SLOT(slotCellSelect(bool)));
311 editCut=new QAction(tr("Cut Cells"), tr("Cu&t"), 0, this); 298 editCut=new QAction(tr("Cut Cells"), tr("Cu&t"), 0, this);
312 editCopy=new QAction(tr("Copy Cells"), tr("&Copy"), 0, this); 299 editCopy=new QAction(tr("Copy Cells"), tr("&Copy"), 0, this);
313 editPaste=new QAction(tr("Paste Cells"), tr("&Paste"), 0, this); 300 editPaste=new QAction(tr("Paste Cells"), tr("&Paste"), 0, this);
314 connect(editPaste, SIGNAL(activated()), this, SLOT(slotEditPaste())); 301 connect(editPaste, SIGNAL(activated()), this, SLOT(slotEditPaste()));
315 editPasteContents=new QAction(tr("Paste Contents"), tr("Paste Cont&ents"), 0, this); 302 editPasteContents=new QAction(tr("Paste Contents"), tr("Paste Cont&ents"), 0, this);
316 connect(editPasteContents, SIGNAL(activated()), this, SLOT(slotEditPasteContents())); 303 connect(editPasteContents, SIGNAL(activated()), this, SLOT(slotEditPasteContents()));
317 editClear=new QAction(tr("Clear Cells"), tr("C&lear"), 0, this); 304 editClear=new QAction(tr("Clear Cells"), tr("C&lear"), 0, this);
318 305
319 insertCells=new QAction(tr("Insert Cells"), tr("C&ells"), 0, this); 306 insertCells=new QAction(tr("Insert Cells"), tr("C&ells"), 0, this);
320 connect(insertCells, SIGNAL(activated()), this, SLOT(slotInsertCells())); 307 connect(insertCells, SIGNAL(activated()), this, SLOT(slotInsertCells()));
@@ -347,46 +334,46 @@ void MainWindow::initActions()
347 connect(colHide, SIGNAL(activated()), this, SLOT(slotColumnHide())); 334 connect(colHide, SIGNAL(activated()), this, SLOT(slotColumnHide()));
348 335
349 sheetRename=new QAction(tr("Rename Sheet"), tr("&Rename"), 0, this); 336 sheetRename=new QAction(tr("Rename Sheet"), tr("&Rename"), 0, this);
350 connect(sheetRename, SIGNAL(activated()), this, SLOT(slotSheetRename())); 337 connect(sheetRename, SIGNAL(activated()), this, SLOT(slotSheetRename()));
351 sheetRemove=new QAction(tr("Remove Sheet"), tr("R&emove"), 0, this); 338 sheetRemove=new QAction(tr("Remove Sheet"), tr("R&emove"), 0, this);
352 connect(sheetRemove, SIGNAL(activated()), this, SLOT(slotSheetRemove())); 339 connect(sheetRemove, SIGNAL(activated()), this, SLOT(slotSheetRemove()));
353 340
354 dataSort=new QAction(tr("Sort Data"), tr("&Sort"), 0, this); 341 dataSort=new QAction(tr("Sort Data"), tr("&Sort"), 0, this);
355 connect(dataSort, SIGNAL(activated()), this, SLOT(slotDataSort())); 342 connect(dataSort, SIGNAL(activated()), this, SLOT(slotDataSort()));
356 dataFindReplace=new QAction(tr("Find && Replace"), tr("&Find && Replace"), 0, this); 343 dataFindReplace=new QAction(tr("Find && Replace"), tr("&Find && Replace"), 0, this);
357 connect(dataFindReplace, SIGNAL(activated()), this, SLOT(slotDataFindReplace())); 344 connect(dataFindReplace, SIGNAL(activated()), this, SLOT(slotDataFindReplace()));
358 345
359 funcEqual=new QAction(tr("Equal To"), QPixmap(func_equal_xpm), tr("&Equal To"), 0, this); 346 funcEqual=new QAction(tr("Equal To"), Resource::loadPixmap( "opie-sheet/func_equal" ), tr("&Equal To"), 0, this);
360 funcEqual->setToolTip("="); 347 funcEqual->setToolTip("=");
361 connect(funcEqual, SIGNAL(activated()), this, SLOT(slotFuncOutput())); 348 connect(funcEqual, SIGNAL(activated()), this, SLOT(slotFuncOutput()));
362 funcPlus=new QAction(tr("Addition"), QPixmap(func_plus_xpm), tr("&Addition"), 0, this); 349 funcPlus=new QAction(tr("Addition"), Resource::loadPixmap( "opie-sheet/func_plus" ), tr("&Addition"), 0, this);
363 funcPlus->setToolTip("+"); 350 funcPlus->setToolTip("+");
364 connect(funcPlus, SIGNAL(activated()), this, SLOT(slotFuncOutput())); 351 connect(funcPlus, SIGNAL(activated()), this, SLOT(slotFuncOutput()));
365 funcMinus=new QAction(tr("Subtraction"), QPixmap(func_minus_xpm), tr("&Subtraction"), 0, this); 352 funcMinus=new QAction(tr("Subtraction"), Resource::loadPixmap( "opie-sheet/func_minus" ), tr("&Subtraction"), 0, this);
366 funcMinus->setToolTip("-"); 353 funcMinus->setToolTip("-");
367 connect(funcMinus, SIGNAL(activated()), this, SLOT(slotFuncOutput())); 354 connect(funcMinus, SIGNAL(activated()), this, SLOT(slotFuncOutput()));
368 funcCross=new QAction(tr("Multiplication"), QPixmap(func_cross_xpm), tr("&Multiplication"), 0, this); 355 funcCross=new QAction(tr("Multiplication"), Resource::loadPixmap ("opie-sheet/func_cross" ), tr("&Multiplication"), 0, this);
369 funcCross->setToolTip("*"); 356 funcCross->setToolTip("*");
370 connect(funcCross, SIGNAL(activated()), this, SLOT(slotFuncOutput())); 357 connect(funcCross, SIGNAL(activated()), this, SLOT(slotFuncOutput()));
371 funcDivide=new QAction(tr("Division"), QPixmap(func_divide_xpm), tr("&Division"), 0, this); 358 funcDivide=new QAction(tr("Division"), Resource::loadPixmap( "opie-sheet/func_divide" ), tr("&Division"), 0, this);
372 funcDivide->setToolTip("/"); 359 funcDivide->setToolTip("/");
373 connect(funcDivide, SIGNAL(activated()), this, SLOT(slotFuncOutput())); 360 connect(funcDivide, SIGNAL(activated()), this, SLOT(slotFuncOutput()));
374 funcParanOpen=new QAction(tr("Open ParanthesistempCellData->row+row1, tempCellData->col+col1"), QPixmap(func_paran_open_xpm), tr("&Open Paranthesis"), 0, this); 361 funcParanOpen=new QAction(tr("Open ParanthesistempCellData->row+row1, tempCellData->col+col1"), Resource::loadPixmap( "opie-sheet/func_paran_open" ), tr("&Open Paranthesis"), 0, this);
375 funcParanOpen->setToolTip("("); 362 funcParanOpen->setToolTip("(");
376 connect(funcParanOpen, SIGNAL(activated()), this, SLOT(slotFuncOutput())); 363 connect(funcParanOpen, SIGNAL(activated()), this, SLOT(slotFuncOutput()));
377 funcParanClose=new QAction(tr("Close Paranthesis"), QPixmap(func_paran_close_xpm), tr("&Close Paranthesis"), 0, this); 364 funcParanClose=new QAction(tr("Close Paranthesis"), Resource::loadPixmap( "opie-sheet/func_paran_close" ), tr("&Close Paranthesis"), 0, this);
378 funcParanClose->setToolTip(")"); 365 funcParanClose->setToolTip(")");
379 connect(funcParanClose, SIGNAL(activated()), this, SLOT(slotFuncOutput())); 366 connect(funcParanClose, SIGNAL(activated()), this, SLOT(slotFuncOutput()));
380 funcComma=new QAction(tr("Comma"), QPixmap(func_comma_xpm), tr("&Comma"), 0, this); 367 funcComma=new QAction(tr("Comma"), Resource::loadPixmap( "opie-sheet/func_comma" ), tr("&Comma"), 0, this);
381 funcComma->setToolTip(","); 368 funcComma->setToolTip(",");
382 connect(funcComma, SIGNAL(activated()), this, SLOT(slotFuncOutput())); 369 connect(funcComma, SIGNAL(activated()), this, SLOT(slotFuncOutput()));
383} 370}
384 371
385void MainWindow::initMenu() 372void MainWindow::initMenu()
386{ 373{
387 menu=new QMenuBar(this); 374 menu=new QMenuBar(this);
388 375
389 menuFile=new QPopupMenu; 376 menuFile=new QPopupMenu;
390 fileNew->addTo(menuFile); 377 fileNew->addTo(menuFile);
391 fileOpen->addTo(menuFile); 378 fileOpen->addTo(menuFile);
392 fileSave->addTo(menuFile); 379 fileSave->addTo(menuFile);
@@ -604,25 +591,25 @@ void MainWindow::initFunctionsToolbar()
604 moveToolBar(toolbarFunctions, Bottom); 591 moveToolBar(toolbarFunctions, Bottom);
605 592
606 funcEqual->addTo(toolbarFunctions); 593 funcEqual->addTo(toolbarFunctions);
607 funcPlus->addTo(toolbarFunctions); 594 funcPlus->addTo(toolbarFunctions);
608 funcMinus->addTo(toolbarFunctions); 595 funcMinus->addTo(toolbarFunctions);
609 funcCross->addTo(toolbarFunctions); 596 funcCross->addTo(toolbarFunctions);
610 funcDivide->addTo(toolbarFunctions); 597 funcDivide->addTo(toolbarFunctions);
611 funcParanOpen->addTo(toolbarFunctions); 598 funcParanOpen->addTo(toolbarFunctions);
612 funcParanClose->addTo(toolbarFunctions); 599 funcParanClose->addTo(toolbarFunctions);
613 funcComma->addTo(toolbarFunctions); 600 funcComma->addTo(toolbarFunctions);
614 601
615 toolFunction=new QToolButton(toolbarFunctions); 602 toolFunction=new QToolButton(toolbarFunctions);
616 toolFunction->setPixmap(func_func_xpm); 603 toolFunction->setPixmap(Resource::loadPixmap( "opie-sheet/func_func" ));
617 toolFunction->setTextLabel(tr("Functions")); 604 toolFunction->setTextLabel(tr("Functions"));
618 toolFunction->setPopup(submenuFunc); 605 toolFunction->setPopup(submenuFunc);
619 toolFunction->setPopupDelay(0); 606 toolFunction->setPopupDelay(0);
620} 607}
621 608
622void MainWindow::initEditToolbar() 609void MainWindow::initEditToolbar()
623{ 610{
624 toolbarEdit=new QToolBar(this); 611 toolbarEdit=new QToolBar(this);
625 toolbarEdit->setHorizontalStretchable(TRUE); 612 toolbarEdit->setHorizontalStretchable(TRUE);
626 moveToolBar(toolbarEdit, Bottom); 613 moveToolBar(toolbarEdit, Bottom);
627 614
628 editAccept->addTo(toolbarEdit); 615 editAccept->addTo(toolbarEdit);