summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-sheet/mainwindow.cpp38
-rw-r--r--noncore/apps/opie-sheet/mainwindow.h5
2 files changed, 20 insertions, 23 deletions
diff --git a/noncore/apps/opie-sheet/mainwindow.cpp b/noncore/apps/opie-sheet/mainwindow.cpp
index efbcc20..09ee68b 100644
--- a/noncore/apps/opie-sheet/mainwindow.cpp
+++ b/noncore/apps/opie-sheet/mainwindow.cpp
@@ -55,2 +55,3 @@ MainWindow::MainWindow()
55 // construct objects 55 // construct objects
56 currentDoc=0;
56 fileSelector=new FileSelector("application/sheet-qt", this, QString::null); 57 fileSelector=new FileSelector("application/sheet-qt", this, QString::null);
@@ -73,3 +74,3 @@ MainWindow::MainWindow()
73 // create sheets 74 // create sheets
74 selectorFileNew(currentDoc); 75 selectorFileNew(DocLnk());
75} 76}
@@ -78,5 +79,6 @@ MainWindow::~MainWindow()
78{ 79{
80 if (currentDoc) delete currentDoc;
79} 81}
80 82
81void MainWindow::documentSave(DocLnk &lnkDoc) 83void MainWindow::documentSave(DocLnk *lnkDoc)
82{ 84{
@@ -102,4 +104,4 @@ void MainWindow::documentSave(DocLnk &lnkDoc)
102 104
103 lnkDoc.setType("application/sheet-qt"); 105 lnkDoc->setType("application/sheet-qt");
104 if (!fm.saveFile(lnkDoc, streamBuffer)) 106 if (!fm.saveFile(*lnkDoc, streamBuffer))
105 { 107 {
@@ -174,3 +176,3 @@ int MainWindow::saveCurrentFile(bool ask=TRUE)
174 176
175 if (currentDoc.name().isEmpty() || !currentDoc.isValid()) 177 if (!currentDoc->isValid())
176 { 178 {
@@ -179,3 +181,5 @@ int MainWindow::saveCurrentFile(bool ask=TRUE)
179 181
180 currentDoc.setName(dialogText.getValue()); 182 currentDoc->setName(dialogText.getValue());
183 currentDoc->setFile(QString::null);
184 currentDoc->setLinkFile(QString::null);
181 } 185 }
@@ -186,12 +190,2 @@ int MainWindow::saveCurrentFile(bool ask=TRUE)
186 190
187void MainWindow::copyDocLnk(const DocLnk &source, DocLnk &target)
188{
189 target.setName(source.name());
190 target.setFile(source.file());
191 target.setLinkFile(source.linkFile());
192 target.setComment(source.comment());
193 target.setType(source.type());
194 target.setCategories(source.categories());
195}
196
197void MainWindow::selectorFileNew(const DocLnk &lnkDoc) 191void MainWindow::selectorFileNew(const DocLnk &lnkDoc)
@@ -201,3 +195,4 @@ void MainWindow::selectorFileNew(const DocLnk &lnkDoc)
201 if (documentModified && saveCurrentFile()==QMessageBox::Cancel) return; 195 if (documentModified && saveCurrentFile()==QMessageBox::Cancel) return;
202 copyDocLnk(lnkDoc, currentDoc); 196 if (currentDoc) delete currentDoc;
197 currentDoc = new DocLnk(lnkDoc);
203 listSheets.clear(); 198 listSheets.clear();
@@ -225,3 +220,4 @@ void MainWindow::selectorFileOpen(const DocLnk &lnkDoc)
225 if (documentModified && saveCurrentFile()==QMessageBox::Cancel) return; 220 if (documentModified && saveCurrentFile()==QMessageBox::Cancel) return;
226 copyDocLnk(lnkDoc, currentDoc); 221 if (currentDoc) delete currentDoc;
222 currentDoc = new DocLnk(lnkDoc);
227 listSheets.clear(); 223 listSheets.clear();
@@ -756,5 +752,7 @@ void MainWindow::slotFileSaveAs()
756 TextDialog dialogText(this); 752 TextDialog dialogText(this);
757 if (dialogText.exec(tr("Save File As"), tr("&File Name:"), currentDoc.name())!=QDialog::Accepted || dialogText.getValue().isEmpty()) return; 753 if (dialogText.exec(tr("Save File As"), tr("&File Name:"), currentDoc->name())!=QDialog::Accepted || dialogText.getValue().isEmpty()) return;
758 754
759 currentDoc.setName(dialogText.getValue()); 755 currentDoc->setName(dialogText.getValue());
756 currentDoc->setFile(QString::null);
757 currentDoc->setLinkFile(QString::null);
760 documentSave(currentDoc); 758 documentSave(currentDoc);
diff --git a/noncore/apps/opie-sheet/mainwindow.h b/noncore/apps/opie-sheet/mainwindow.h
index 554e6f6..d68e25c 100644
--- a/noncore/apps/opie-sheet/mainwindow.h
+++ b/noncore/apps/opie-sheet/mainwindow.h
@@ -41,3 +41,3 @@ class MainWindow: public QMainWindow
41 // QPE objects 41 // QPE objects
42 DocLnk currentDoc; 42 DocLnk* currentDoc;
43 QPEMenuBar *menu; 43 QPEMenuBar *menu;
@@ -78,4 +78,3 @@ class MainWindow: public QMainWindow
78 void documentOpen(const DocLnk &lnkDoc); 78 void documentOpen(const DocLnk &lnkDoc);
79 void copyDocLnk(const DocLnk &source, DocLnk &target); 79 void documentSave(DocLnk *lnkDoc);
80 void documentSave(DocLnk &lnkDoc);
81 void closeEvent(QCloseEvent *e); 80 void closeEvent(QCloseEvent *e);