summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/textedit/textedit.cpp67
-rw-r--r--core/apps/textedit/textedit.h1
2 files changed, 42 insertions, 26 deletions
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp
index e978fa4..b199c81 100644
--- a/core/apps/textedit/textedit.cpp
+++ b/core/apps/textedit/textedit.cpp
@@ -244,5 +244,6 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f )
doc = 0;
edited=false;
- edited1=false;
+ fromSetDocument=false;
+
setToolBarsMovable( false );
connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
@@ -270,5 +271,5 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f )
QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) );
- a->addTo( bar );
+// a->addTo( bar );
a->addTo( file );
@@ -281,4 +282,5 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f )
connect( a, SIGNAL( activated() ), this, SLOT( save() ) );
file->insertSeparator();
+ a->addTo( bar );
a->addTo( file );
@@ -340,4 +342,5 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f )
nStart->setToggleAction(true);
nStart->addTo( advancedMenu );
+ nStart->setEnabled(false);
nAdvanced = new QAction( tr("Prompt on Exit"), QString::null, 0, this, 0 );
@@ -437,5 +440,5 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f )
if( qApp->argc() > 1) {
currentFileName=qApp->argv()[1];
-// qDebug("<<<<<<<<<<<<<<<<<<<<<<<< "+currentFileName+" %d",qApp->argc());
+
QFileInfo fi(currentFileName);
@@ -446,14 +449,17 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f )
}
} else {
-// qDebug("Do other thing");
- if(startWithNew) {
+ edited1=false;
+
+// if(startWithNew ) {
openDotFile("");
// fileNew();
- } else {
- fileOpen();
- }
+// }
+// else {
+// fileOpen();
+// }
}
viewSelection = cfg.readNumEntry( "FileView", 0 );
+// setCaption(tr("Text Editor"));
}
@@ -696,5 +702,5 @@ void TextEdit::openFile( const QString &f ) {
QFileInfo fi( f);
// bFromDocView = true;
- if(f.find(".desktop",0,true) != -1 && !openDesktop) {
+ if(f.find(".desktop",0,true) != -1 && !openDesktop ) {
switch ( QMessageBox::warning(this,tr("Text Editor"),
tr("Text Editor has detected<BR>you selected a <B>.desktop</B>
@@ -827,4 +833,6 @@ bool TextEdit::save() {
prompted save */
bool TextEdit::saveAs() {
+ if(caption() == tr("Text Editor"))
+ return false;
qDebug("saveAsFile " + currentFileName);
// case of nothing to save...
@@ -964,17 +972,17 @@ void TextEdit::setDocument(const QString& fileref) {
currentFileName=fileref;
qDebug("setDocument");
- QFileInfo fi(currentFileName);
- qDebug("basename:"+fi.baseName()+": current filenmame "+currentFileName);
- if(fi.baseName().left(1) == "") {
-// openDotFile(currentFileName);
- } else {
- qDebug("setDoc open");
- bFromDocView = true;
- openFile(fileref);
- editor->setEdited(true);
- edited1=false;
- edited=true;
-
-// doSearchBar();
+ QFileInfo fi(currentFileName);
+ qDebug("basename:"+fi.baseName()+": current filenmame "+currentFileName);
+ if(fi.baseName().left(1) == "") {
+ // openDotFile(currentFileName);
+ } else {
+ qDebug("setDoc open");
+ bFromDocView = true;
+ openFile(fileref);
+ editor->setEdited(true);
+ edited1=false;
+ edited=true;
+ // fromSetDocument=false;
+ // doSearchBar();
}
}
@@ -998,5 +1006,9 @@ void TextEdit::changeFont() {
void TextEdit::editDelete() {
- switch ( QMessageBox::warning(this,tr("Text Editor"),tr("Do you really want<BR>to <B>delete</B> the current file\nfrom the disk?<BR>This is <B>irreversable!!</B>"),tr("Yes"),tr("No"),0,0,1) ) {
+ switch ( QMessageBox::warning(this,tr("Text Editor"),
+ tr("Do you really want<BR>to <B>delete</B> "
+ "the current file\nfrom the disk?<BR>This is "
+ "<B>irreversable!!</B>"),
+ tr("Yes"),tr("No"),0,0,1) ) {
case 0:
if(doc) {
@@ -1020,6 +1032,7 @@ void TextEdit::changeStartConfig( bool b ) {
}
-void TextEdit::editorChanged() {
- if(editor->edited() && edited && !edited1) {
+void TextEdit::editorChanged() {
+// qDebug("editor changed");
+ if( /*editor->edited() &&*/ /*edited && */!edited1) {
setCaption( "*"+caption());
edited1=true;
@@ -1028,11 +1041,13 @@ void TextEdit::editorChanged() {
}
-void TextEdit::receive(const QCString&msg, const QByteArray&) {
+void TextEdit::receive(const QCString&msg, const QByteArray &data) {
qDebug("QCop "+msg);
if ( msg == "setDocument(QString)" ) {
qDebug("bugger all");
+
}
}
+
void TextEdit::doAbout() {
QMessageBox::about(0,tr("Text Edit"),tr("Text Edit is copyright<BR>"
diff --git a/core/apps/textedit/textedit.h b/core/apps/textedit/textedit.h
index bb7d693..9f16ebf 100644
--- a/core/apps/textedit/textedit.h
+++ b/core/apps/textedit/textedit.h
@@ -117,4 +117,5 @@ private:
// fileSaver *fileSaveDlg;
// fileBrowser *browseForFiles;
+ bool fromSetDocument;
QpeEditor* editor;
QToolBar *menu, *editBar, *searchBar;