summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-sheet/mainwindow.cpp
Side-by-side diff
Diffstat (limited to 'noncore/apps/opie-sheet/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-sheet/mainwindow.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/noncore/apps/opie-sheet/mainwindow.cpp b/noncore/apps/opie-sheet/mainwindow.cpp
index bd98aca..3d3c688 100644
--- a/noncore/apps/opie-sheet/mainwindow.cpp
+++ b/noncore/apps/opie-sheet/mainwindow.cpp
@@ -1,47 +1,50 @@
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
/*
* Opie Sheet (formerly Sheet/Qt)
* by Serdar Ozler <sozler@sitebest.com>
*/
#include "mainwindow.h"
#include <qpe/filemanager.h>
#include <qpe/qcopenvelope_qws.h>
#include <qpe/resource.h>
+#include <qpe/qpeapplication.h>
+
#include <qmessagebox.h>
#include <qfile.h>
#include <qtranslator.h>
#include <qradiobutton.h>
+
#include "cellformat.h"
#include "numberdlg.h"
#include "textdlg.h"
#include "sortdlg.h"
#include "finddlg.h"
#define DEFAULT_NUM_ROWS 300
#define DEFAULT_NUM_COLS (26*3)
#define DEFAULT_NUM_SHEETS 3
MainWindow::MainWindow(QWidget *parent, const char* n, WFlags fl)
:QMainWindow(parent, n, fl)
{
// initialize variables
documentModified=FALSE;
// construct objects
currentDoc=0;
fileSelector=new FileSelector("application/sheet-qt", this, QString::null);
ExcelSelector=new FileSelector("application/excel",this,QString::null,FALSE);
connect(fileSelector, SIGNAL(closeMe()), this, SLOT(selectorHide()));
connect(fileSelector, SIGNAL(newSelected(const DocLnk &)), this, SLOT(selectorFileNew(const DocLnk &)));
connect(fileSelector, SIGNAL(fileSelected(const DocLnk &)), this, SLOT(selectorFileOpen(const DocLnk &)));
connect(ExcelSelector,SIGNAL(fileSelected(const DocLnk &)),this,SLOT(slotImportExcel(const DocLnk &)));
@@ -726,49 +729,49 @@ typeSheet *MainWindow::findSheet(const QString &name)
if (tempSheet->name==name)
return tempSheet;
return NULL;
}
void MainWindow::slotSheetChanged(const QString &name)
{
sheet->copySheetData(&findSheet(sheet->getName())->data);
sheet->setName(name);
sheet->setSheetData(&findSheet(name)->data);
sheet->ReCalc();
}
void MainWindow::addFlyAction(const QString &text, const QString &menuText, const QString &tip, QWidget *w)
{
QAction *action=new QAction(text, menuText, 0, this);
action->setToolTip(tip);
connect(action, SIGNAL(activated()), this, SLOT(slotFuncOutput()));
action->addTo(w);
}
void MainWindow::slotFormatCells()
{
CellFormat dialogCellFormat(this);
- dialogCellFormat.showMaximized();
+ QPEApplication::showDialog( &dialogCellFormat );
dialogCellFormat.exec(sheet);
}
void MainWindow::slotEditPaste()
{
sheet->editPaste();
}
void MainWindow::slotEditPasteContents()
{
sheet->editPaste(TRUE);
}
void MainWindow::slotRowHeight()
{
int row1, row2, col1, col2;
sheet->getSelection(&row1, &col1, &row2, &col2);
NumberDialog dialogNumber(this);
if (dialogNumber.exec(tr("Row Height"), tr("&Height of each row:"), sheet->rowHeight(row1))==QDialog::Accepted)
{
int newHeight=dialogNumber.getValue(), row;
for (row=row1; row<=row2; ++row)
sheet->setRowHeight(row, newHeight);
@@ -946,63 +949,63 @@ void MainWindow::slotSheetRemove()
{
if (comboSheets->count()<2)
{
QMessageBox::warning(this, tr("Error"), tr("There is only one sheet!"));
return;
}
if (QMessageBox::information(this, tr("Remove Sheet"), tr("Are you sure?"), QMessageBox::Yes, QMessageBox::No)==QMessageBox::Yes)
{
typeSheet *tempSheet=findSheet(sheet->getName());
for (int i=0; i<comboSheets->count(); ++i)
if (comboSheets->text(i)==tempSheet->name)
{
comboSheets->removeItem(i);
break;
}
comboSheets->setCurrentItem(0);
slotSheetChanged(comboSheets->currentText());
listSheets.remove(tempSheet);
}
}
void MainWindow::slotDataSort()
{
SortDialog dialogSort(this);
- dialogSort.showMaximized();
+ QPEApplication::showDialog( &dialogSort );
dialogSort.exec(sheet);
}
void MainWindow::slotDocModified()
{
documentModified=TRUE;
}
void MainWindow::slotInsertCells()
{
QDialog dialogInsert(this, 0, TRUE);
dialogInsert.resize(180, 130);
dialogInsert.setCaption(tr("Insert Cells"));
QVButtonGroup *group=new QVButtonGroup(tr("&Type"), &dialogInsert);
group->setGeometry(10, 10, 160, 110);
QRadioButton *radio=new QRadioButton(tr("Shift cells &down"), group);
radio=new QRadioButton(tr("Shift cells &right"), group);
radio=new QRadioButton(tr("Entire ro&w"), group);
radio=new QRadioButton(tr("Entire &column"), group);
group->setButton(0);
if (dialogInsert.exec()==QDialog::Accepted)
switch (group->id(group->selected()))
{
case 0: sheet->insertRows(1, FALSE); break;
case 1: sheet->insertColumns(1, FALSE); break;
case 2: sheet->insertRows(1, TRUE); break;
case 3: sheet->insertColumns(1, TRUE); break;
}
}
void MainWindow::slotDataFindReplace()
{
FindDialog dialogFind(this);
- dialogFind.showMaximized();
+ QPEApplication::showDialog( &dialogFind );
dialogFind.exec(sheet);
}