author | llornkcor <llornkcor> | 2002-12-26 03:49:11 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-12-26 03:49:11 (UTC) |
commit | e4e891190200cf26ba4bafcadca17f2473493276 (patch) (unidiff) | |
tree | 16d36e9a6253758c7da926e457cfb613775dae28 | |
parent | f736bf0ae774159a80a97b9492d7624e7caf07a3 (diff) | |
download | opie-e4e891190200cf26ba4bafcadca17f2473493276.zip opie-e4e891190200cf26ba4bafcadca17f2473493276.tar.gz opie-e4e891190200cf26ba4bafcadca17f2473493276.tar.bz2 |
hook up save and saveAs
-rw-r--r-- | noncore/apps/tinykate/tinykate.cpp | 41 | ||||
-rw-r--r-- | noncore/apps/tinykate/tinykate.h | 4 |
2 files changed, 43 insertions, 2 deletions
diff --git a/noncore/apps/tinykate/tinykate.cpp b/noncore/apps/tinykate/tinykate.cpp index a823530..c8c3b31 100644 --- a/noncore/apps/tinykate/tinykate.cpp +++ b/noncore/apps/tinykate/tinykate.cpp | |||
@@ -36,2 +36,3 @@ | |||
36 | #include <katehighlight.h> | 36 | #include <katehighlight.h> |
37 | #include <kateview.h> | ||
37 | 38 | ||
@@ -73,2 +74,3 @@ TinyKate::TinyKate( QWidget *parent, const char *name, WFlags f) : | |||
73 | a->addTo(popup); | 74 | a->addTo(popup); |
75 | connect(a, SIGNAL(activated()), this, SLOT(slotSave())); | ||
74 | 76 | ||
@@ -77,2 +79,3 @@ TinyKate::TinyKate( QWidget *parent, const char *name, WFlags f) : | |||
77 | a->addTo(popup); | 79 | a->addTo(popup); |
80 | connect(a, SIGNAL(activated()), this, SLOT(slotSaveAs())); | ||
78 | 81 | ||
@@ -170,2 +173,3 @@ void TinyKate::slotCurrentChanged( QWidget * view) | |||
170 | if (currentView) { | 173 | if (currentView) { |
174 | |||
171 | disconnect(editCopy,SIGNAL(activated()),currentView,SLOT(copy())); | 175 | disconnect(editCopy,SIGNAL(activated()),currentView,SLOT(copy())); |
@@ -199,3 +203,5 @@ void TinyKate::slotNew( ) | |||
199 | KTextEditor::View *kv; | 203 | KTextEditor::View *kv; |
200 | tabwidget->addTab(kv=kd->createView(tabwidget,"BLAH"),"tinykate/tinykate",tr("Unnamed %1").arg(nextUnnamed++)); | 204 | tabwidget->addTab(kv=kd->createView(tabwidget,"BLAH"), |
205 | "tinykate/tinykate", | ||
206 | tr("Unnamed %1").arg(nextUnnamed++)); | ||
201 | viewCount++; | 207 | viewCount++; |
@@ -214 +220,34 @@ void TinyKate::slotClose( ) | |||
214 | 220 | ||
221 | void TinyKate::slotSave() { | ||
222 | // feel free to make this how you want | ||
223 | if (currentView==0) return; | ||
224 | |||
225 | // KateView *kv = (KateView*) currentView; | ||
226 | KateDocument *kd = (KateDocument*) currentView->document(); | ||
227 | // qDebug("saving file "+kd->docName()); | ||
228 | if( kd->docName().isEmpty()) | ||
229 | slotSaveAs(); | ||
230 | else | ||
231 | kd->saveFile(); | ||
232 | // kv->save(); | ||
233 | // kd->saveFile(); | ||
234 | } | ||
235 | |||
236 | void TinyKate::slotSaveAs() { | ||
237 | if (currentView==0) return; | ||
238 | KateDocument *kd = (KateDocument*) currentView->document(); | ||
239 | |||
240 | QString filename=OFileDialog::getSaveFileName(OFileSelector::EXTENDED_ALL); | ||
241 | if (!filename.isEmpty()) { | ||
242 | qDebug("saving file "+filename); | ||
243 | QFileInfo fi(filename); | ||
244 | QString filenamed = fi.fileName(); | ||
245 | kd->setDocFile( filename); | ||
246 | kd->setDocName( filenamed); | ||
247 | kd->saveFile(); | ||
248 | // KTextEditor::View *dv = currentView; | ||
249 | // tabwidget->changeTab( dv, filenamed); | ||
250 | // need to change tab label here | ||
251 | } | ||
252 | |||
253 | } | ||
diff --git a/noncore/apps/tinykate/tinykate.h b/noncore/apps/tinykate/tinykate.h index ef0dcba..7b61bae 100644 --- a/noncore/apps/tinykate/tinykate.h +++ b/noncore/apps/tinykate/tinykate.h | |||
@@ -35,2 +35,3 @@ public: | |||
35 | public slots: | 35 | public slots: |
36 | QString currentFileName; | ||
36 | void slotNew(); | 37 | void slotNew(); |
@@ -41,3 +42,4 @@ protected slots: | |||
41 | void slotCurrentChanged(QWidget *); | 42 | void slotCurrentChanged(QWidget *); |
42 | 43 | void slotSave(); | |
44 | void slotSaveAs(); | ||
43 | protected: | 45 | protected: |