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.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/noncore/apps/opie-sheet/mainwindow.cpp b/noncore/apps/opie-sheet/mainwindow.cpp
index 7394623..3095142 100644
--- a/noncore/apps/opie-sheet/mainwindow.cpp
+++ b/noncore/apps/opie-sheet/mainwindow.cpp
@@ -868,41 +868,44 @@ void MainWindow::slotFileSaveAs()
868 TextDialog dialogText(this); 868 TextDialog dialogText(this);
869 if (dialogText.exec(tr("Save File As"), tr("&File Name:"), currentDoc->name())!=QDialog::Accepted || dialogText.getValue().isEmpty()) return; 869 if (dialogText.exec(tr("Save File As"), tr("&File Name:"), currentDoc->name())!=QDialog::Accepted || dialogText.getValue().isEmpty()) return;
870 870
871 currentDoc->setName(dialogText.getValue()); 871 currentDoc->setName(dialogText.getValue());
872 currentDoc->setFile(QString::null); 872 currentDoc->setFile(QString::null);
873 currentDoc->setLinkFile(QString::null); 873 currentDoc->setLinkFile(QString::null);
874 documentSave(currentDoc); 874 documentSave(currentDoc);
875} 875}
876 876
877void MainWindow::slotImportExcel(const DocLnk &lnkDoc) 877void MainWindow::slotImportExcel(const DocLnk &lnkDoc)
878{ 878{
879 ExcelBook file1; 879 ExcelBook file1;
880 file1.ParseBook((char *)lnkDoc.file().ascii()); 880 if ( !file1.ParseBook((char *)lnkDoc.file().ascii()) ){
881 QMessageBox::critical(this, tr("Error"), tr("<td>Unable to open or parse file!</td>"));
882 return;
883 }
881 int NumOfSheets=file1.Sheets.count(); 884 int NumOfSheets=file1.Sheets.count();
882 printf("OpieSheet::NumberOfSheets:%d\r\n",NumOfSheets); 885 printf("OpieSheet::NumberOfSheets:%d\r\n",NumOfSheets);
883 if (documentModified && saveCurrentFile()==QMessageBox::Cancel) return; 886 if (documentModified && saveCurrentFile()==QMessageBox::Cancel) return;
884 if (currentDoc) delete currentDoc; 887 if (currentDoc) delete currentDoc;
885 currentDoc = new DocLnk(); 888 currentDoc = new DocLnk();
886 listSheets.clear(); 889 listSheets.clear();
887 comboSheets->clear(); 890 comboSheets->clear();
888 int w1,r,c; 891 int w1,r,c;
889 ExcelSheet* sh1; 892 ExcelSheet* sh1;
890 typeSheet* newSheet; 893 typeSheet* newSheet;
891 QString* str; 894 QString* str;
892 typeCellData* newCell; 895 typeCellData* newCell;
893 for(w1=1;w1<=NumOfSheets;w1++) 896 for(w1=1;w1<=NumOfSheets;w1++)
894 { 897 {
895 sh1=file1.Sheets[w1-1]; 898 sh1=file1.Sheets[w1-1];
896 printf("OpieSheet:newSheet:%x,r=%d,c=%d\r\n",sh1,sh1->rows,sh1->cols); 899 // printf("OpieSheet:newSheet:%x,r=%d,c=%d\r\n",sh1, sh1->rows,sh1->cols);
897 newSheet=new typeSheet; 900 newSheet=new typeSheet;
898 newSheet->data.setAutoDelete(TRUE); 901 newSheet->data.setAutoDelete(TRUE);
899 newSheet->name=sh1->name; 902 newSheet->name=sh1->name;
900 printf("OpieSheet:Sheetname:%s\r\n",sh1->name.ascii()); 903 printf("OpieSheet:Sheetname:%s\r\n",sh1->name.ascii());
901 comboSheets->insertItem(newSheet->name); 904 comboSheets->insertItem(newSheet->name);
902 for(r=1; r <= sh1->rows; r++) 905 for(r=1; r <= sh1->rows; r++)
903 { 906 {
904 for(c=1;c <= sh1->cols; c++) 907 for(c=1;c <= sh1->cols; c++)
905 { 908 {
906 str=file1.CellDataString(sh1,r-1,c-1); 909 str=file1.CellDataString(sh1,r-1,c-1);
907 if(str!=NULL && r<DEFAULT_NUM_ROWS && c<DEFAULT_NUM_COLS) 910 if(str!=NULL && r<DEFAULT_NUM_ROWS && c<DEFAULT_NUM_COLS)
908 { 911 {