-rw-r--r-- | noncore/apps/tinykate/tinykate.cpp | 41 | ||||
-rw-r--r-- | noncore/apps/tinykate/tinykate.h | 6 |
2 files changed, 44 insertions, 3 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 @@ #include <katehighlight.h> +#include <kateview.h> @@ -73,2 +74,3 @@ TinyKate::TinyKate( QWidget *parent, const char *name, WFlags f) : a->addTo(popup); + connect(a, SIGNAL(activated()), this, SLOT(slotSave())); @@ -77,2 +79,3 @@ TinyKate::TinyKate( QWidget *parent, const char *name, WFlags f) : a->addTo(popup); + connect(a, SIGNAL(activated()), this, SLOT(slotSaveAs())); @@ -170,2 +173,3 @@ void TinyKate::slotCurrentChanged( QWidget * view) if (currentView) { + disconnect(editCopy,SIGNAL(activated()),currentView,SLOT(copy())); @@ -199,3 +203,5 @@ void TinyKate::slotNew( ) KTextEditor::View *kv; - tabwidget->addTab(kv=kd->createView(tabwidget,"BLAH"),"tinykate/tinykate",tr("Unnamed %1").arg(nextUnnamed++)); + tabwidget->addTab(kv=kd->createView(tabwidget,"BLAH"), + "tinykate/tinykate", + tr("Unnamed %1").arg(nextUnnamed++)); viewCount++; @@ -214 +220,34 @@ void TinyKate::slotClose( ) +void TinyKate::slotSave() { + // feel free to make this how you want + if (currentView==0) return; + + // KateView *kv = (KateView*) currentView; + KateDocument *kd = (KateDocument*) currentView->document(); + // qDebug("saving file "+kd->docName()); + if( kd->docName().isEmpty()) + slotSaveAs(); + else + kd->saveFile(); + // kv->save(); + // kd->saveFile(); +} + +void TinyKate::slotSaveAs() { + if (currentView==0) return; + KateDocument *kd = (KateDocument*) currentView->document(); + + QString filename=OFileDialog::getSaveFileName(OFileSelector::EXTENDED_ALL); + if (!filename.isEmpty()) { + qDebug("saving file "+filename); + QFileInfo fi(filename); + QString filenamed = fi.fileName(); + kd->setDocFile( filename); + kd->setDocName( filenamed); + kd->saveFile(); +// KTextEditor::View *dv = currentView; +// tabwidget->changeTab( dv, filenamed); + // need to change tab label here + } + +} 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 @@ -2,3 +2,3 @@ tinykate.h - Tiny KATE mainwindow + Tiny KATE mainwindow ------------------- @@ -35,2 +35,3 @@ public: public slots: + QString currentFileName; void slotNew(); @@ -41,3 +42,4 @@ protected slots: void slotCurrentChanged(QWidget *); - + void slotSave(); + void slotSaveAs(); protected: |