summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-sheet/mainwindow.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/apps/opie-sheet/mainwindow.cpp b/noncore/apps/opie-sheet/mainwindow.cpp
index d47a570..07e581a 100644
--- a/noncore/apps/opie-sheet/mainwindow.cpp
+++ b/noncore/apps/opie-sheet/mainwindow.cpp
@@ -91,385 +91,385 @@ void MainWindow::documentSave(DocLnk *lnkDoc)
91 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; 91 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;
92 } 92 }
93 93
94 lnkDoc->setType("application/sheet-qt"); 94 lnkDoc->setType("application/sheet-qt");
95 if (!fm.saveFile(*lnkDoc, streamBuffer)) 95 if (!fm.saveFile(*lnkDoc, streamBuffer))
96 { 96 {
97 QMessageBox::critical(this, tr("Error"), tr("File cannot be saved!")); 97 QMessageBox::critical(this, tr("Error"), tr("File cannot be saved!"));
98 return; 98 return;
99 } 99 }
100 documentModified=FALSE; 100 documentModified=FALSE;
101} 101}
102 102
103void MainWindow::documentOpen(const DocLnk &lnkDoc) 103void MainWindow::documentOpen(const DocLnk &lnkDoc)
104{ 104{
105 FileManager fm; 105 FileManager fm;
106 QByteArray streamBuffer; 106 QByteArray streamBuffer;
107 if (!lnkDoc.isValid() || !fm.loadFile(lnkDoc, streamBuffer)) 107 if (!lnkDoc.isValid() || !fm.loadFile(lnkDoc, streamBuffer))
108 { 108 {
109 QMessageBox::critical(this, tr("Error"), tr("File cannot be opened!")); 109 QMessageBox::critical(this, tr("Error"), tr("File cannot be opened!"));
110 documentModified=FALSE; 110 documentModified=FALSE;
111 selectorFileNew(DocLnk()); 111 selectorFileNew(DocLnk());
112 return; 112 return;
113 } 113 }
114 QDataStream stream(streamBuffer, IO_ReadOnly); 114 QDataStream stream(streamBuffer, IO_ReadOnly);
115 115
116 Q_UINT32 countSheet, countCell, i, j, row, col, alignment; 116 Q_UINT32 countSheet, countCell, i, j, row, col, alignment;
117 typeSheet *newSheet; 117 typeSheet *newSheet;
118 typeCellData *newCell; 118 typeCellData *newCell;
119 119
120 char fileFormat[7]; 120 char fileFormat[7];
121 stream.readRawBytes(fileFormat, 6); 121 stream.readRawBytes(fileFormat, 6);
122 fileFormat[6]=0; 122 fileFormat[6]=0;
123 if ((QString)fileFormat!="SQT100") 123 if ((QString)fileFormat!="SQT100")
124 { 124 {
125 QMessageBox::critical(this, tr("Error"), tr("Invalid file format!")); 125 QMessageBox::critical(this, tr("Error"), tr("Invalid file format!"));
126 documentModified=FALSE; 126 documentModified=FALSE;
127 selectorFileNew(DocLnk()); 127 selectorFileNew(DocLnk());
128 return; 128 return;
129 } 129 }
130 130
131 stream >> countSheet; 131 stream >> countSheet;
132 for (i=0; i<countSheet; ++i) 132 for (i=0; i<countSheet; ++i)
133 { 133 {
134 newSheet=new typeSheet; 134 newSheet=new typeSheet;
135 newSheet->data.setAutoDelete(TRUE); 135 newSheet->data.setAutoDelete(TRUE);
136 stream >> newSheet->name >> countCell; 136 stream >> newSheet->name >> countCell;
137 comboSheets->insertItem(newSheet->name); 137 comboSheets->insertItem(newSheet->name);
138 138
139 for (j=0; j<countCell; ++j) 139 for (j=0; j<countCell; ++j)
140 { 140 {
141 newCell=new typeCellData; 141 newCell=new typeCellData;
142 stream >> col >> row >> newCell->borders.right >> newCell->borders.bottom >> newCell->background >> alignment >> newCell->fontColor >> newCell->font >> newCell->data; 142 stream >> col >> row >> newCell->borders.right >> newCell->borders.bottom >> newCell->background >> alignment >> newCell->fontColor >> newCell->font >> newCell->data;
143 newCell->col=col; 143 newCell->col=col;
144 newCell->row=row; 144 newCell->row=row;
145 newCell->alignment=(Qt::AlignmentFlags)alignment; 145 newCell->alignment=(Qt::AlignmentFlags)alignment;
146 newSheet->data.append(newCell); 146 newSheet->data.append(newCell);
147 } 147 }
148 listSheets.append(newSheet); 148 listSheets.append(newSheet);
149 149
150 if (i==0) 150 if (i==0)
151 { 151 {
152 sheet->setName(newSheet->name); 152 sheet->setName(newSheet->name);
153 sheet->setSheetData(&newSheet->data); 153 sheet->setSheetData(&newSheet->data);
154 } 154 }
155 } 155 }
156} 156}
157 157
158int MainWindow::saveCurrentFile(bool ask) 158int MainWindow::saveCurrentFile(bool ask)
159{ 159{
160 if (ask) 160 if (ask)
161 { 161 {
162 int result=QMessageBox::information(this, tr("Save File"), tr("Do you want to save the current file?"), QMessageBox::Yes, QMessageBox::No, QMessageBox::Cancel); 162 int result=QMessageBox::information(this, tr("Save File"), tr("Do you want to save the current file?"), QMessageBox::Yes, QMessageBox::No, QMessageBox::Cancel);
163 if (result!=QMessageBox::Yes) return result; 163 if (result!=QMessageBox::Yes) return result;
164 } 164 }
165 165
166 if (!currentDoc->isValid()) 166 if (!currentDoc->isValid())
167 { 167 {
168 TextDialog dialogText(this); 168 TextDialog dialogText(this);
169 if (dialogText.exec(tr("Save File"), tr("&File Name:"), tr("UnnamedFile"))!=QDialog::Accepted || dialogText.getValue().isEmpty()) return QMessageBox::Cancel; 169 if (dialogText.exec(tr("Save File"), tr("&File Name:"), tr("UnnamedFile"))!=QDialog::Accepted || dialogText.getValue().isEmpty()) return QMessageBox::Cancel;
170 170
171 currentDoc->setName(dialogText.getValue()); 171 currentDoc->setName(dialogText.getValue());
172 currentDoc->setFile(QString::null); 172 currentDoc->setFile(QString::null);
173 currentDoc->setLinkFile(QString::null); 173 currentDoc->setLinkFile(QString::null);
174 } 174 }
175 175
176 documentSave(currentDoc); 176 documentSave(currentDoc);
177 return QMessageBox::Yes; 177 return QMessageBox::Yes;
178} 178}
179 179
180void MainWindow::selectorFileNew(const DocLnk &lnkDoc) 180void MainWindow::selectorFileNew(const DocLnk &lnkDoc)
181{ 181{
182 selectorHide(); 182 selectorHide();
183 183
184 if (documentModified && saveCurrentFile()==QMessageBox::Cancel) return; 184 if (documentModified && saveCurrentFile()==QMessageBox::Cancel) return;
185 if (currentDoc) delete currentDoc; 185 if (currentDoc) delete currentDoc;
186 currentDoc = new DocLnk(lnkDoc); 186 currentDoc = new DocLnk(lnkDoc);
187 editData->clear(); 187 editData->clear();
188 listSheets.clear(); 188 listSheets.clear();
189 comboSheets->clear(); 189 comboSheets->clear();
190 190
191 typeSheet *newSheet=createNewSheet(); 191 typeSheet *newSheet=createNewSheet();
192 newSheet->data.setAutoDelete(TRUE); 192 newSheet->data.setAutoDelete(TRUE);
193 sheet->setName(newSheet->name); 193 sheet->setName(newSheet->name);
194 sheet->setSheetData(&newSheet->data); 194 sheet->setSheetData(&newSheet->data);
195 for (int i=1; i<DEFAULT_NUM_SHEETS; ++i) 195 for (int i=1; i<DEFAULT_NUM_SHEETS; ++i)
196 createNewSheet(); 196 createNewSheet();
197 documentModified=FALSE; 197 documentModified=FALSE;
198} 198}
199 199
200void MainWindow::closeEvent(QCloseEvent *e) 200void MainWindow::closeEvent(QCloseEvent *e)
201{ 201{
202 if (documentModified && saveCurrentFile()==QMessageBox::Cancel) e->ignore(); 202 if (documentModified && saveCurrentFile()==QMessageBox::Cancel) e->ignore();
203 else e->accept(); 203 else e->accept();
204} 204}
205 205
206void MainWindow::selectorFileOpen(const DocLnk &lnkDoc) 206void MainWindow::selectorFileOpen(const DocLnk &lnkDoc)
207{ 207{
208 selectorHide(); 208 selectorHide();
209 209
210 if (documentModified && saveCurrentFile()==QMessageBox::Cancel) return; 210 if (documentModified && saveCurrentFile()==QMessageBox::Cancel) return;
211 if (currentDoc) delete currentDoc; 211 if (currentDoc) delete currentDoc;
212 currentDoc = new DocLnk(); 212 currentDoc = new DocLnk();
213 listSheets.clear(); 213 listSheets.clear();
214 comboSheets->clear(); 214 comboSheets->clear();
215 215
216 documentOpen(lnkDoc); 216 documentOpen(lnkDoc);
217 documentModified=FALSE; 217 documentModified=FALSE;
218} 218}
219 219
220void MainWindow::selectorShow() 220void MainWindow::selectorShow()
221{ 221{
222 sheet->hide(); 222 sheet->hide();
223 setCentralWidget(fileSelector); 223 setCentralWidget(fileSelector);
224 fileSelector->show(); 224 fileSelector->show();
225 fileSelector->reread(); 225 fileSelector->reread();
226} 226}
227 227
228void MainWindow::selectorHide() 228void MainWindow::selectorHide()
229{ 229{
230 fileSelector->hide(); 230 fileSelector->hide();
231 setCentralWidget(sheet); 231 setCentralWidget(sheet);
232 sheet->show(); 232 sheet->show();
233} 233}
234 234
235void MainWindow::slotFileNew() 235void MainWindow::slotFileNew()
236{ 236{
237 selectorFileNew(DocLnk()); 237 selectorFileNew(DocLnk());
238} 238}
239 239
240void MainWindow::slotFileOpen() 240void MainWindow::slotFileOpen()
241{ 241{
242 selectorShow(); 242 selectorShow();
243} 243}
244 244
245void MainWindow::slotImportExcelOpen() 245void MainWindow::slotImportExcelOpen()
246{ 246{
247 sheet->hide(); 247 sheet->hide();
248 setCentralWidget(ExcelSelector); 248 setCentralWidget(ExcelSelector);
249 ExcelSelector->show(); 249 ExcelSelector->show();
250 ExcelSelector->reread(); 250 ExcelSelector->reread();
251} 251}
252 252
253void MainWindow::ExcelSelectorHide() 253void MainWindow::ExcelSelectorHide()
254{ 254{
255 ExcelSelector->hide(); 255 ExcelSelector->hide();
256 setCentralWidget(sheet); 256 setCentralWidget(sheet);
257 sheet->show(); 257 sheet->show();
258} 258}
259 259
260void MainWindow::slotFileSave() 260void MainWindow::slotFileSave()
261{ 261{
262 saveCurrentFile(FALSE); 262 saveCurrentFile(FALSE);
263} 263}
264 264
265void MainWindow::setDocument(const QString &applnk_filename) 265void MainWindow::setDocument(const QString &applnk_filename)
266{ 266{
267 selectorFileOpen(DocLnk(applnk_filename)); 267 selectorFileOpen(DocLnk(applnk_filename));
268} 268}
269 269
270void MainWindow::initActions() 270void MainWindow::initActions()
271{ 271{
272 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);
273 connect(fileNew, SIGNAL(activated()), this, SLOT(slotFileNew())); 273 connect(fileNew, SIGNAL(activated()), this, SLOT(slotFileNew()));
274 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);
275 connect(fileOpen, SIGNAL(activated()), this, SLOT(slotFileOpen())); 275 connect(fileOpen, SIGNAL(activated()), this, SLOT(slotFileOpen()));
276 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);
277 connect(fileSave, SIGNAL(activated()), this, SLOT(slotFileSave())); 277 connect(fileSave, SIGNAL(activated()), this, SLOT(slotFileSave()));
278 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);
279 connect(fileSaveAs, SIGNAL(activated()), this, SLOT(slotFileSaveAs())); 279 connect(fileSaveAs, SIGNAL(activated()), this, SLOT(slotFileSaveAs()));
280 280
281 //fileQuit=new QAction(tr("Quit"), tr("&Quit"), 0, this); 281 //fileQuit=new QAction(tr("Quit"), tr("&Quit"), 0, this);
282 //connect(fileQuit, SIGNAL(activated()), this, SLOT(close())); 282 //connect(fileQuit, SIGNAL(activated()), this, SLOT(close()));
283 fileExcelImport=new QAction(tr("Import Excel file"),Resource::loadPixmap( "/opie-sheet/excel16" ),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);
284 connect(fileExcelImport, SIGNAL(activated()), this, SLOT(slotImportExcelOpen())); 284 connect(fileExcelImport, SIGNAL(activated()), this, SLOT(slotImportExcelOpen()));
285 285
286 // 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);
287 //connect(helpGeneral, SIGNAL(activated()), this, SLOT(slotHelpGeneral())); 287 //connect(helpGeneral, SIGNAL(activated()), this, SLOT(slotHelpGeneral()));
288 //helpAbout=new QAction(tr("About Opie Sheet"), tr("&About"), 0, this); 288 //helpAbout=new QAction(tr("About Opie Sheet"), tr("&About"), 0, this);
289 //connect(helpAbout, SIGNAL(activated()), this, SLOT(slotHelpAbout())); 289 //connect(helpAbout, SIGNAL(activated()), this, SLOT(slotHelpAbout()));
290 290
291 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);
292 connect(editAccept, SIGNAL(activated()), this, SLOT(slotEditAccept())); 292 connect(editAccept, SIGNAL(activated()), this, SLOT(slotEditAccept()));
293 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);
294 connect(editCancel, SIGNAL(activated()), this, SLOT(slotEditCancel())); 294 connect(editCancel, SIGNAL(activated()), this, SLOT(slotEditCancel()));
295 editCellSelect=new QAction(tr("Cell Selector"), Resource::loadPixmap( "opie-sheet/cell_select" ), tr("Cell &Selector"), 0, this); 295 editCellSelect=new QAction(tr("Cell Selector"), Resource::loadPixmap( "opie-sheet/cell_select" ), tr("Cell &Selector"), 0, this);
296 editCellSelect->setToggleAction(TRUE); 296 editCellSelect->setToggleAction(TRUE);
297 connect(editCellSelect, SIGNAL(toggled(bool)), this, SLOT(slotCellSelect(bool))); 297 connect(editCellSelect, SIGNAL(toggled(bool)), this, SLOT(slotCellSelect(bool)));
298 editCut=new QAction(tr("Cut Cells"), tr("Cu&t"), 0, this); 298 editCut=new QAction(tr("Cut Cells"), tr("Cu&t"), 0, this);
299 editCopy=new QAction(tr("Copy Cells"), tr("&Copy"), 0, this); 299 editCopy=new QAction(tr("Copy Cells"), tr("&Copy"), 0, this);
300 editPaste=new QAction(tr("Paste Cells"), tr("&Paste"), 0, this); 300 editPaste=new QAction(tr("Paste Cells"), tr("&Paste"), 0, this);
301 connect(editPaste, SIGNAL(activated()), this, SLOT(slotEditPaste())); 301 connect(editPaste, SIGNAL(activated()), this, SLOT(slotEditPaste()));
302 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);
303 connect(editPasteContents, SIGNAL(activated()), this, SLOT(slotEditPasteContents())); 303 connect(editPasteContents, SIGNAL(activated()), this, SLOT(slotEditPasteContents()));
304 editClear=new QAction(tr("Clear Cells"), tr("C&lear"), 0, this); 304 editClear=new QAction(tr("Clear Cells"), tr("C&lear"), 0, this);
305 305
306 insertCells=new QAction(tr("Insert Cells"), tr("C&ells"), 0, this); 306 insertCells=new QAction(tr("Insert Cells"), tr("C&ells"), 0, this);
307 connect(insertCells, SIGNAL(activated()), this, SLOT(slotInsertCells())); 307 connect(insertCells, SIGNAL(activated()), this, SLOT(slotInsertCells()));
308 insertRows=new QAction(tr("Insert Rows"), tr("&Rows"), 0, this); 308 insertRows=new QAction(tr("Insert Rows"), tr("&Rows"), 0, this);
309 connect(insertRows, SIGNAL(activated()), this, SLOT(slotInsertRows())); 309 connect(insertRows, SIGNAL(activated()), this, SLOT(slotInsertRows()));
310 insertCols=new QAction(tr("Insert Columns"), tr("&Columns"), 0, this); 310 insertCols=new QAction(tr("Insert Columns"), tr("&Columns"), 0, this);
311 connect(insertCols, SIGNAL(activated()), this, SLOT(slotInsertCols())); 311 connect(insertCols, SIGNAL(activated()), this, SLOT(slotInsertCols()));
312 insertSheets=new QAction(tr("Add Sheets"), tr("&Sheets"), 0, this); 312 insertSheets=new QAction(tr("Add Sheets"), tr("&Sheets"), 0, this);
313 connect(insertSheets, SIGNAL(activated()), this, SLOT(slotInsertSheets())); 313 connect(insertSheets, SIGNAL(activated()), this, SLOT(slotInsertSheets()));
314 314
315 formatCells=new QAction(tr("Cells"), tr("&Cells"), 0, this); 315 formatCells=new QAction(tr("Cells"), tr("&Cells"), 0, this);
316 connect(formatCells, SIGNAL(activated()), this, SLOT(slotFormatCells())); 316 connect(formatCells, SIGNAL(activated()), this, SLOT(slotFormatCells()));
317 317
318 rowHeight=new QAction(tr("Row Height"), tr("H&eight"), 0, this); 318 rowHeight=new QAction(tr("Row Height"), tr("H&eight"), 0, this);
319 connect(rowHeight, SIGNAL(activated()), this, SLOT(slotRowHeight())); 319 connect(rowHeight, SIGNAL(activated()), this, SLOT(slotRowHeight()));
320 rowAdjust=new QAction(tr("Adjust Row"), tr("&Adjust"), 0, this); 320 rowAdjust=new QAction(tr("Adjust Row"), tr("&Adjust"), 0, this);
321 connect(rowAdjust, SIGNAL(activated()), this, SLOT(slotRowAdjust())); 321 connect(rowAdjust, SIGNAL(activated()), this, SLOT(slotRowAdjust()));
322 rowShow=new QAction(tr("Show Row"), tr("&Show"), 0, this); 322 rowShow=new QAction(tr("Show Row"), tr("&Show"), 0, this);
323 connect(rowShow, SIGNAL(activated()), this, SLOT(slotRowShow())); 323 connect(rowShow, SIGNAL(activated()), this, SLOT(slotRowShow()));
324 rowHide=new QAction(tr("Hide Row"), tr("&Hide"), 0, this); 324 rowHide=new QAction(tr("Hide Row"), tr("&Hide"), 0, this);
325 connect(rowHide, SIGNAL(activated()), this, SLOT(slotRowHide())); 325 connect(rowHide, SIGNAL(activated()), this, SLOT(slotRowHide()));
326 326
327 colWidth=new QAction(tr("Column Width"), tr("&Width"), 0, this); 327 colWidth=new QAction(tr("Column Width"), tr("&Width"), 0, this);
328 connect(colWidth, SIGNAL(activated()), this, SLOT(slotColumnWidth())); 328 connect(colWidth, SIGNAL(activated()), this, SLOT(slotColumnWidth()));
329 colAdjust=new QAction(tr("Adjust Column"), tr("&Adjust"), 0, this); 329 colAdjust=new QAction(tr("Adjust Column"), tr("&Adjust"), 0, this);
330 connect(colAdjust, SIGNAL(activated()), this, SLOT(slotColumnAdjust())); 330 connect(colAdjust, SIGNAL(activated()), this, SLOT(slotColumnAdjust()));
331 colShow=new QAction(tr("Show Column"), tr("&Show"), 0, this); 331 colShow=new QAction(tr("Show Column"), tr("&Show"), 0, this);
332 connect(colShow, SIGNAL(activated()), this, SLOT(slotColumnShow())); 332 connect(colShow, SIGNAL(activated()), this, SLOT(slotColumnShow()));
333 colHide=new QAction(tr("Hide Column"), tr("&Hide"), 0, this); 333 colHide=new QAction(tr("Hide Column"), tr("&Hide"), 0, this);
334 connect(colHide, SIGNAL(activated()), this, SLOT(slotColumnHide())); 334 connect(colHide, SIGNAL(activated()), this, SLOT(slotColumnHide()));
335 335
336 sheetRename=new QAction(tr("Rename Sheet"), tr("&Rename"), 0, this); 336 sheetRename=new QAction(tr("Rename Sheet"), tr("&Rename"), 0, this);
337 connect(sheetRename, SIGNAL(activated()), this, SLOT(slotSheetRename())); 337 connect(sheetRename, SIGNAL(activated()), this, SLOT(slotSheetRename()));
338 sheetRemove=new QAction(tr("Remove Sheet"), tr("R&emove"), 0, this); 338 sheetRemove=new QAction(tr("Remove Sheet"), tr("R&emove"), 0, this);
339 connect(sheetRemove, SIGNAL(activated()), this, SLOT(slotSheetRemove())); 339 connect(sheetRemove, SIGNAL(activated()), this, SLOT(slotSheetRemove()));
340 340
341 dataSort=new QAction(tr("Sort Data"), tr("&Sort"), 0, this); 341 dataSort=new QAction(tr("Sort Data"), tr("&Sort"), 0, this);
342 connect(dataSort, SIGNAL(activated()), this, SLOT(slotDataSort())); 342 connect(dataSort, SIGNAL(activated()), this, SLOT(slotDataSort()));
343 dataFindReplace=new QAction(tr("Find && Replace"), tr("&Find && Replace"), 0, this); 343 dataFindReplace=new QAction(tr("Find && Replace"), tr("&Find && Replace"), 0, this);
344 connect(dataFindReplace, SIGNAL(activated()), this, SLOT(slotDataFindReplace())); 344 connect(dataFindReplace, SIGNAL(activated()), this, SLOT(slotDataFindReplace()));
345 345
346 funcEqual=new QAction(tr("Equal To"), Resource::loadPixmap( "opie-sheet/func_equal" ), tr("&Equal To"), 0, this); 346 funcEqual=new QAction(tr("Equal To"), Resource::loadPixmap( "opie-sheet/func_equal" ), tr("&Equal To"), 0, this);
347 funcEqual->setToolTip("="); 347 funcEqual->setToolTip("=");
348 connect(funcEqual, SIGNAL(activated()), this, SLOT(slotFuncOutput())); 348 connect(funcEqual, SIGNAL(activated()), this, SLOT(slotFuncOutput()));
349 funcPlus=new QAction(tr("Addition"), Resource::loadPixmap( "opie-sheet/func_plus" ), tr("&Addition"), 0, this); 349 funcPlus=new QAction(tr("Addition"), Resource::loadPixmap( "opie-sheet/func_plus" ), tr("&Addition"), 0, this);
350 funcPlus->setToolTip("+"); 350 funcPlus->setToolTip("+");
351 connect(funcPlus, SIGNAL(activated()), this, SLOT(slotFuncOutput())); 351 connect(funcPlus, SIGNAL(activated()), this, SLOT(slotFuncOutput()));
352 funcMinus=new QAction(tr("Subtraction"), Resource::loadPixmap( "opie-sheet/func_minus" ), tr("&Subtraction"), 0, this); 352 funcMinus=new QAction(tr("Subtraction"), Resource::loadPixmap( "opie-sheet/func_minus" ), tr("&Subtraction"), 0, this);
353 funcMinus->setToolTip("-"); 353 funcMinus->setToolTip("-");
354 connect(funcMinus, SIGNAL(activated()), this, SLOT(slotFuncOutput())); 354 connect(funcMinus, SIGNAL(activated()), this, SLOT(slotFuncOutput()));
355 funcCross=new QAction(tr("Multiplication"), Resource::loadPixmap ("opie-sheet/func_cross" ), tr("&Multiplication"), 0, this); 355 funcCross=new QAction(tr("Multiplication"), Resource::loadPixmap ("opie-sheet/func_cross" ), tr("&Multiplication"), 0, this);
356 funcCross->setToolTip("*"); 356 funcCross->setToolTip("*");
357 connect(funcCross, SIGNAL(activated()), this, SLOT(slotFuncOutput())); 357 connect(funcCross, SIGNAL(activated()), this, SLOT(slotFuncOutput()));
358 funcDivide=new QAction(tr("Division"), Resource::loadPixmap( "opie-sheet/func_divide" ), tr("&Division"), 0, this); 358 funcDivide=new QAction(tr("Division"), Resource::loadPixmap( "opie-sheet/func_divide" ), tr("&Division"), 0, this);
359 funcDivide->setToolTip("/"); 359 funcDivide->setToolTip("/");
360 connect(funcDivide, SIGNAL(activated()), this, SLOT(slotFuncOutput())); 360 connect(funcDivide, SIGNAL(activated()), this, SLOT(slotFuncOutput()));
361 funcParanOpen=new QAction(tr("Open ParanthesistempCellData->row+row1, tempCellData->col+col1"), Resource::loadPixmap( "opie-sheet/func_paran_open" ), 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);
362 funcParanOpen->setToolTip("("); 362 funcParanOpen->setToolTip("(");
363 connect(funcParanOpen, SIGNAL(activated()), this, SLOT(slotFuncOutput())); 363 connect(funcParanOpen, SIGNAL(activated()), this, SLOT(slotFuncOutput()));
364 funcParanClose=new QAction(tr("Close Paranthesis"), Resource::loadPixmap( "opie-sheet/func_paran_close" ), tr("&Close Paranthesis"), 0, this); 364 funcParanClose=new QAction(tr("Close Paranthesis"), Resource::loadPixmap( "opie-sheet/func_paran_close" ), tr("&Close Paranthesis"), 0, this);
365 funcParanClose->setToolTip(")"); 365 funcParanClose->setToolTip(")");
366 connect(funcParanClose, SIGNAL(activated()), this, SLOT(slotFuncOutput())); 366 connect(funcParanClose, SIGNAL(activated()), this, SLOT(slotFuncOutput()));
367 funcComma=new QAction(tr("Comma"), Resource::loadPixmap( "opie-sheet/func_comma" ), tr("&Comma"), 0, this); 367 funcComma=new QAction(tr("Comma"), Resource::loadPixmap( "opie-sheet/func_comma" ), tr("&Comma"), 0, this);
368 funcComma->setToolTip(","); 368 funcComma->setToolTip(",");
369 connect(funcComma, SIGNAL(activated()), this, SLOT(slotFuncOutput())); 369 connect(funcComma, SIGNAL(activated()), this, SLOT(slotFuncOutput()));
370} 370}
371 371
372void MainWindow::initMenu() 372void MainWindow::initMenu()
373{ 373{
374 menu=new QMenuBar(this); 374 menu=new QMenuBar(this);
375 375
376 menuFile=new QPopupMenu; 376 menuFile=new QPopupMenu;
377 fileNew->addTo(menuFile); 377 fileNew->addTo(menuFile);
378 fileOpen->addTo(menuFile); 378 fileOpen->addTo(menuFile);
379 fileSave->addTo(menuFile); 379 fileSave->addTo(menuFile);
380 fileSaveAs->addTo(menuFile); 380 fileSaveAs->addTo(menuFile);
381// menuFile->insertSeparator(); 381// menuFile->insertSeparator();
382// fileQuit->addTo(menuFile); 382// fileQuit->addTo(menuFile);
383 menuFile->insertSeparator(); 383 menuFile->insertSeparator();
384 fileExcelImport->addTo(menuFile); 384 fileExcelImport->addTo(menuFile);
385 menu->insertItem(tr("&File"), menuFile); 385 menu->insertItem(tr("&File"), menuFile);
386 386
387 menuEdit=new QPopupMenu; 387 menuEdit=new QPopupMenu;
388 editAccept->addTo(menuEdit); 388 editAccept->addTo(menuEdit);
389 editCancel->addTo(menuEdit); 389 editCancel->addTo(menuEdit);
390 editCellSelect->addTo(menuEdit); 390 editCellSelect->addTo(menuEdit);
391 menuEdit->insertSeparator(); 391 menuEdit->insertSeparator();
392 editCut->addTo(menuEdit); 392 editCut->addTo(menuEdit);
393 editCopy->addTo(menuEdit); 393 editCopy->addTo(menuEdit);
394 editPaste->addTo(menuEdit); 394 editPaste->addTo(menuEdit);
395 editPasteContents->addTo(menuEdit); 395 editPasteContents->addTo(menuEdit);
396 editClear->addTo(menuEdit); 396 editClear->addTo(menuEdit);
397 menu->insertItem(tr("&Edit"), menuEdit); 397 menu->insertItem(tr("&Edit"), menuEdit);
398 398
399 menuInsert=new QPopupMenu; 399 menuInsert=new QPopupMenu;
400 menu->insertItem(tr("&Insert"), menuInsert); 400 menu->insertItem(tr("&Insert"), menuInsert);
401 401
402 menuFormat=new QPopupMenu; 402 menuFormat=new QPopupMenu;
403 formatCells->addTo(menuFormat); 403 formatCells->addTo(menuFormat);
404 menu->insertItem(tr("&Format"), menuFormat); 404 menu->insertItem(tr("&Format"), menuFormat);
405 405
406 menuData=new QPopupMenu; 406 menuData=new QPopupMenu;
407 dataSort->addTo(menuData); 407 dataSort->addTo(menuData);
408 dataFindReplace->addTo(menuData); 408 dataFindReplace->addTo(menuData);
409 menu->insertItem(tr("&Data"), menuData); 409 menu->insertItem(tr("&Data"), menuData);
410 410
411// menuHelp=new QPopupMenu; 411// menuHelp=new QPopupMenu;
412// helpGeneral->addTo(menuHelp); 412// helpGeneral->addTo(menuHelp);
413// helpAbout->addTo(menuHelp); 413// helpAbout->addTo(menuHelp);
414// menu->insertItem(tr("&Help"), menuHelp); 414// menu->insertItem(tr("&Help"), menuHelp);
415 415
416 submenuRow=new QPopupMenu; 416 submenuRow=new QPopupMenu;
417 rowHeight->addTo(submenuRow); 417 rowHeight->addTo(submenuRow);
418 rowAdjust->addTo(submenuRow); 418 rowAdjust->addTo(submenuRow);
419 rowShow->addTo(submenuRow); 419 rowShow->addTo(submenuRow);
420 rowHide->addTo(submenuRow); 420 rowHide->addTo(submenuRow);
421 menuFormat->insertItem(tr("&Row"), submenuRow); 421 menuFormat->insertItem(tr("&Row"), submenuRow);
422 422
423 submenuCol=new QPopupMenu; 423 submenuCol=new QPopupMenu;
424 colWidth->addTo(submenuCol); 424 colWidth->addTo(submenuCol);
425 colAdjust->addTo(submenuCol); 425 colAdjust->addTo(submenuCol);
426 colShow->addTo(submenuCol); 426 colShow->addTo(submenuCol);
427 colHide->addTo(submenuCol); 427 colHide->addTo(submenuCol);
428 menuFormat->insertItem(tr("Colum&n"), submenuCol); 428 menuFormat->insertItem(tr("Colum&n"), submenuCol);
429 429
430 submenuSheet=new QPopupMenu; 430 submenuSheet=new QPopupMenu;
431 sheetRename->addTo(submenuSheet); 431 sheetRename->addTo(submenuSheet);
432 sheetRemove->addTo(submenuSheet); 432 sheetRemove->addTo(submenuSheet);
433 menuFormat->insertItem(tr("&Sheet"), submenuSheet); 433 menuFormat->insertItem(tr("&Sheet"), submenuSheet);
434 434
435 submenuFunc=new QPopupMenu; 435 submenuFunc=new QPopupMenu;
436 menuInsert->insertItem(tr("&Function"), submenuFunc); 436 menuInsert->insertItem(tr("&Function"), submenuFunc);
437 437
438 submenuFuncStd=new QPopupMenu; 438 submenuFuncStd=new QPopupMenu;
439 funcPlus->addTo(submenuFuncStd); 439 funcPlus->addTo(submenuFuncStd);
440 funcMinus->addTo(submenuFuncStd); 440 funcMinus->addTo(submenuFuncStd);
441 funcCross->addTo(submenuFuncStd); 441 funcCross->addTo(submenuFuncStd);
442 funcDivide->addTo(submenuFuncStd); 442 funcDivide->addTo(submenuFuncStd);
443 submenuFunc->insertItem(tr("&Simple"), submenuFuncStd); 443 submenuFunc->insertItem(tr("&Simple"), submenuFuncStd);
444 444
445 445
446 446
447 submenuFuncStandard=new QPopupMenu; 447 submenuFuncStandard=new QPopupMenu;
448 addFlyAction(tr("ABS(x)"), tr("ABS(x)"), "ABS(", submenuFuncStandard); 448 addFlyAction(tr("ABS(x)"), tr("ABS(x)"), "ABS(", submenuFuncStandard);
449 addFlyAction(tr("CEILING(x,acc)"), tr("CEILING(x,acc)"), "CEILING(", submenuFuncStandard); 449 addFlyAction(tr("CEILING(x,acc)"), tr("CEILING(x,acc)"), "CEILING(", submenuFuncStandard);
450 addFlyAction(tr("FACT(x)"), tr("FACT(x)"), "FACT(", submenuFuncStandard); 450 addFlyAction(tr("FACT(x)"), tr("FACT(x)"), "FACT(", submenuFuncStandard);
451 addFlyAction(tr("FLOOR(x,acc)"), tr("FLOOR(x,acc)"), "FLOOR(", submenuFuncStandard); 451 addFlyAction(tr("FLOOR(x,acc)"), tr("FLOOR(x,acc)"), "FLOOR(", submenuFuncStandard);
452 addFlyAction(tr("INT(x)"), tr("INT(x)"), "INT(", submenuFuncStandard); 452 addFlyAction(tr("INT(x)"), tr("INT(x)"), "INT(", submenuFuncStandard);
453 addFlyAction(tr("MOD(x,y)"), tr("MOD(x,y)"), "MOD(", submenuFuncStandard); 453 addFlyAction(tr("MOD(x,y)"), tr("MOD(x,y)"), "MOD(", submenuFuncStandard);
454 addFlyAction(tr("ROUND(x,digits)"), tr("ROUND(x,digits)"), "ROUND(", submenuFuncStandard); 454 addFlyAction(tr("ROUND(x,digits)"), tr("ROUND(x,digits)"), "ROUND(", submenuFuncStandard);
455 addFlyAction(tr("SIGN(x)"), tr("SIGN(x)"), "SIGN(", submenuFuncStandard); 455 addFlyAction(tr("SIGN(x)"), tr("SIGN(x)"), "SIGN(", submenuFuncStandard);
456 submenuFuncStandard->insertSeparator(); 456 submenuFuncStandard->insertSeparator();
457 addFlyAction(tr("EXP(x)"), tr("EXP(x)"), "EXP(", submenuFuncStandard); 457 addFlyAction(tr("EXP(x)"), tr("EXP(x)"), "EXP(", submenuFuncStandard);
458 addFlyAction(tr("LN(x)"), tr("LN(x)"), "LN(", submenuFuncStandard); 458 addFlyAction(tr("LN(x)"), tr("LN(x)"), "LN(", submenuFuncStandard);
459 addFlyAction(tr("LOG(x,b)"), tr("LOG(x,b)"), "LOG(", submenuFuncStandard); 459 addFlyAction(tr("LOG(x,b)"), tr("LOG(x,b)"), "LOG(", submenuFuncStandard);
460 addFlyAction(tr("LOG10(x)"), tr("LOG10(x)"), "LOG10(", submenuFuncStandard); 460 addFlyAction(tr("LOG10(x)"), tr("LOG10(x)"), "LOG10(", submenuFuncStandard);
461 addFlyAction(tr("POWER(x,y)"), tr("POWER(x,y)"), "POWER(", submenuFuncStandard); 461 addFlyAction(tr("POWER(x,y)"), tr("POWER(x,y)"), "POWER(", submenuFuncStandard);
462 addFlyAction(tr("SQRT(x)"), tr("SQRT(x)"), "SQRT(", submenuFuncStandard); 462 addFlyAction(tr("SQRT(x)"), tr("SQRT(x)"), "SQRT(", submenuFuncStandard);
463 submenuFuncStandard->insertSeparator(); 463 submenuFuncStandard->insertSeparator();
464 addFlyAction(tr("DEGREES(x)"), tr("DEGREES(x)"), "DEGREES(", submenuFuncStandard); 464 addFlyAction(tr("DEGREES(x)"), tr("DEGREES(x)"), "DEGREES(", submenuFuncStandard);
465 addFlyAction(tr("RADIANS(x)"), tr("RADIANS(x)"), "RADIANS(", submenuFuncStandard); 465 addFlyAction(tr("RADIANS(x)"), tr("RADIANS(x)"), "RADIANS(", submenuFuncStandard);
466 addFlyAction(tr("PI()"), tr("PI()"), "PI()", submenuFuncStandard); 466 addFlyAction(tr("PI()"), tr("PI()"), "PI()", submenuFuncStandard);
467 addFlyAction(tr("RAND()"), tr("RAND()"), "RAND(", submenuFuncStandard); 467 addFlyAction(tr("RAND()"), tr("RAND()"), "RAND(", submenuFuncStandard);
468 addFlyAction(tr("RANDBETWEEN(a,b)"), tr("RANDBETWEEN(a,b)"), "RANDBETWEEN(", submenuFuncStandard); 468 addFlyAction(tr("RANDBETWEEN(a,b)"), tr("RANDBETWEEN(a,b)"), "RANDBETWEEN(", submenuFuncStandard);
469 submenuFunc->insertItem(tr("S&tandard"), submenuFuncStandard); 469 submenuFunc->insertItem(tr("S&tandard"), submenuFuncStandard);
470 470
471 submenuFuncLogic=new QPopupMenu; 471 submenuFuncLogic=new QPopupMenu;
472 addFlyAction(tr("AND(x1,x2)"), tr("AND(x1,x2)"), "AND(", submenuFuncLogic); 472 addFlyAction(tr("AND(x1,x2)"), tr("AND(x1,x2)"), "AND(", submenuFuncLogic);
473 addFlyAction(tr("NOT(x)"), tr("NOT(x)"), "NOT(", submenuFuncLogic); 473 addFlyAction(tr("NOT(x)"), tr("NOT(x)"), "NOT(", submenuFuncLogic);
474 addFlyAction(tr("OR(x1,x2)"), tr("OR(x1,x2)"), "OR(", submenuFuncLogic); 474 addFlyAction(tr("OR(x1,x2)"), tr("OR(x1,x2)"), "OR(", submenuFuncLogic);
475 submenuFuncLogic->insertSeparator(); 475 submenuFuncLogic->insertSeparator();