summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/textedit/fileBrowser.cpp28
-rw-r--r--core/apps/textedit/textedit.cpp99
-rw-r--r--core/apps/textedit/textedit.h7
3 files changed, 73 insertions, 61 deletions
diff --git a/core/apps/textedit/fileBrowser.cpp b/core/apps/textedit/fileBrowser.cpp
index bc99348..f322513 100644
--- a/core/apps/textedit/fileBrowser.cpp
+++ b/core/apps/textedit/fileBrowser.cpp
@@ -50,3 +50,3 @@ fileBrowser::fileBrowser( QWidget* parent, const char* name, bool modal, WFlags
if ( !name )
- setName( tr("fileBrowser") );
+ setName( "fileBrowser" );
setCaption(tr( name ) );
@@ -122,3 +122,3 @@ fileBrowser::fileBrowser( QWidget* parent, const char* name, bool modal, WFlags
ListView->setColumnWidth(1,-1);
- ListView->addColumn( tr("Date"),-1);
+ ListView->addColumn( "Date",-1);
@@ -136,3 +136,3 @@ fileBrowser::fileBrowser( QWidget* parent, const char* name, bool modal, WFlags
FileStack->addWidget( ListView, get_unique_id() );
-
+mimeType="text/plain";
fileSelector = new FileSelector( mimeType, FileStack, "fileselector" , FALSE, FALSE); //buggy
@@ -350,3 +350,3 @@ void fileBrowser::selectionChanged( const QString &select )
{
- if ( select == tr("Documents")) {
+ if ( select == "Documents") {
FileStack->raiseWidget( fileSelector );
@@ -357,3 +357,3 @@ void fileBrowser::selectionChanged( const QString &select )
} else {
- if ( select == tr("All files") )
+ if ( select == "All files" )
currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::All);
@@ -414,3 +414,3 @@ void fileBrowser::makDir() {
InputDialog *fileDlg;
- fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0);
+ fileDlg = new InputDialog(this,"Make Directory",TRUE, 0);
fileDlg->exec();
@@ -427,3 +427,3 @@ void fileBrowser::localRename() {
InputDialog *fileDlg;
- fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0);
+ fileDlg = new InputDialog(this,"Rename",TRUE, 0);
fileDlg->setTextEdit((const QString &) curFile);
@@ -434,3 +434,3 @@ void fileBrowser::localRename() {
if( rename(oldname.latin1(), newName.latin1())== -1)
- QMessageBox::message(tr("Note"),tr("Could not rename"));
+ QMessageBox::message("Note","Could not rename");
}
@@ -442,4 +442,4 @@ void fileBrowser::localDelete() {
if(QDir(f).exists() ) {
- switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+
- tr(" ?\nIt must be empty"),tr("Yes"),tr("No"),0,0,1) ) {
+ switch ( QMessageBox::warning(this,"Delete","Do you really want to delete\n"+f+
+ " ?\nIt must be empty","Yes","No",0,0,1) ) {
case 0: {
@@ -456,4 +456,4 @@ void fileBrowser::localDelete() {
} else {
- switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f
- +" ?",tr("Yes"),tr("No"),0,0,1) ) {
+ switch ( QMessageBox::warning(this,"Delete","Do you really want to delete\n"+f
+ +" ?","Yes","No",0,0,1) ) {
case 0: {
@@ -495,3 +495,3 @@ void fileBrowser::showType(const QString &t) {
qDebug(t);
- if(t.find(tr("All"),0,TRUE) != -1) {
+ if(t.find("All",0,TRUE) != -1) {
filterStr = "*";
@@ -607,3 +607,3 @@ InputDialog::InputDialog( QWidget* parent, const char* name, bool modal, WFlags
if ( !name )
- setName( tr("InputDialog") );
+ setName( "InputDialog" );
resize( 234, 50 );
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp
index 6804918..943fecd 100644
--- a/core/apps/textedit/textedit.cpp
+++ b/core/apps/textedit/textedit.cpp
@@ -37,2 +37,3 @@
#include <qpe/qpetoolbar.h>
+#include <qpe/qcopenvelope_qws.h>
//#include <qpe/finddialog.h>
@@ -240,2 +241,6 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f )
+ channel = new QCopChannel( "QPE/Application/textedit", this );
+ connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
+ this, SLOT(receive(const QCString&, const QByteArray&)) );
+
setIcon( Resource::loadPixmap( "TextEditor" ) );
@@ -399,9 +404,9 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f )
- cfg.setGroup("View");
- if(cfg.readEntry("startNew","TRUE") == "TRUE") {
- nStart->setOn(TRUE);
- fileNew();
- } else {
- fileOpen();
- }
+ cfg.setGroup("View");
+ if(cfg.readEntry("startNew","TRUE") == "TRUE") {
+ nStart->setOn(TRUE);
+ fileNew();
+ } else {
+ fileOpen();
+ }
viewSelection = cfg.readNumEntry( "FileView", 0 );
@@ -487,5 +492,5 @@ void TextEdit::fileNew()
{
- if( !bFromDocView ) {
- saveAs();
- }
+// if( !bFromDocView ) {
+// saveAs();
+// }
newFile(DocLnk());
@@ -495,5 +500,7 @@ void TextEdit::fileOpen()
{
- browseForFiles=new fileBrowser(this,tr("Open File"),TRUE,0, "text/*"); //
+ browseForFiles = new fileBrowser(this,tr("Open File"),TRUE,0, "text/*"); //
browseForFiles->setFileView( viewSelection );
browseForFiles->showMaximized();
+// if( result != -1 )
+
if( browseForFiles->exec() != -1 ) {
@@ -620,4 +627,6 @@ void TextEdit::newFile( const DocLnk &f )
doc = new DocLnk(nf);
+ currentFileName = "Unnamed";
qDebug("newFile "+currentFileName);
- updateCaption(currentFileName);
+ updateCaption( currentFileName);
+// editor->setEdited( FALSE);
}
@@ -627,3 +636,3 @@ void TextEdit::openFile( const QString &f )
- bFromDocView = TRUE;
+// bFromDocView = TRUE;
DocLnk nf;
@@ -638,3 +647,3 @@ void TextEdit::openFile( const QString &f )
showEditTools();
- // Show filename in caption
+ // Show filename in caption
QString name = f;
@@ -642,3 +651,3 @@ void TextEdit::openFile( const QString &f )
if ( sep > 0 )
- name = name.mid( sep+1 );
+ name = name.mid( sep+1 );
updateCaption( name );
@@ -649,3 +658,3 @@ void TextEdit::openFile( const DocLnk &f )
// clear();
- bFromDocView = TRUE;
+// bFromDocView = TRUE;
FileManager fm;
@@ -655,11 +664,8 @@ void TextEdit::openFile( const DocLnk &f )
if ( !fm.loadFile( f, txt ) ) {
- // ####### could be a new file
+ // ####### could be a new file
qDebug( "Cannot open file" );
-
- //return;
}
-
- fileNew();
+// fileNew();
if ( doc )
- delete doc;
+ delete doc;
doc = new DocLnk(f);
@@ -670,3 +676,2 @@ void TextEdit::openFile( const DocLnk &f )
- qDebug("openFile doclnk "+currentFileName);
doc->setName(currentFileName);
@@ -693,5 +698,5 @@ bool TextEdit::save()
QString file = doc->file();
- qDebug(file);
+ qDebug("saver file "+file);
QString name= doc->name();
- qDebug(name);
+ qDebug("File named "+name);
QString rt = editor->text();
@@ -733,9 +738,8 @@ bool TextEdit::saveAs()
// qDebug("saveAsFile "+currentFileName);
-
- // case of nothing to save... /// there's always something to save
-// if ( !doc )//|| !bFromDocView)
-// {
-// qDebug("no doc");
-// return true;
-// }
+ // case of nothing to save...
+ if ( !doc )//|| !bFromDocView)
+ {
+ qDebug("no doc");
+ return true;
+ }
if ( !editor->edited() ) {
@@ -749,3 +753,3 @@ bool TextEdit::saveAs()
- if( currentFileName.isEmpty() || currentFileName == tr("Unnamed")) {
+ if( currentFileName.isEmpty() || currentFileName == tr("Unnamed") || currentFileName == tr("Text Editor")) {
qDebug("do silly TT filename thing");
@@ -816,3 +820,3 @@ bool TextEdit::saveAs()
return true;
-}
+} //end saveAs
@@ -837,3 +841,4 @@ void TextEdit::updateCaption( const QString &name )
}
-
+ if(s.left(1) == "/")
+ s = s.right(s.length()-1);
setCaption( s + " - " + tr("Text Editor") );
@@ -845,8 +850,7 @@ void TextEdit::setDocument(const QString& fileref)
bFromDocView = TRUE;
- qDebug("setDocument "+fileref);
- bFromDocView = TRUE;
if(fileref.find(".desktop",0,TRUE) == -1) {
- openFile(fileref);
+ openFile(fileref);
} else {
- openFile(DocLnk(fileref));
+ qDebug("is desktop file");
+ openFile(DocLnk(fileref));
}
@@ -866,8 +870,5 @@ void TextEdit::accept()
{
- QString file = doc->file();
- if (file.find("_.txt",0,TRUE) ==-1)
- save();
- else {
- QFile(file).remove();
- }
+ //if(caption() !="Unnamed")
+ if(edited1)
+ saveAs();
exit(0);
@@ -936 +937,9 @@ void TextEdit::editorChanged() {
}
+
+void TextEdit::receive(const QCString&msg, const QByteArray&) {
+ qDebug("QCop "+msg);
+ if ( msg == "setDocument(QString)" ) {
+ qDebug("bugger all");
+ }
+
+}
diff --git a/core/apps/textedit/textedit.h b/core/apps/textedit/textedit.h
index af69518..61fa2a0 100644
--- a/core/apps/textedit/textedit.h
+++ b/core/apps/textedit/textedit.h
@@ -30,2 +30,5 @@
#include <qpe/filemanager.h>
+#include <qpe/qcopenvelope_qws.h>
+
+#include <opie/ofileselector.h>
@@ -59,5 +62,6 @@ public:
void openFile( const QString & );
+ QCopChannel * channel;
public slots:
void editorChanged();
-
+void receive(const QCString&, const QByteArray&);
protected:
@@ -108,3 +112,2 @@ private:
fileBrowser *browseForFiles;
-
QpeEditor* editor;