summaryrefslogtreecommitdiff
path: root/core/apps/textedit
authorar <ar>2004-02-07 23:52:31 (UTC)
committer ar <ar>2004-02-07 23:52:31 (UTC)
commit6582895befc98131430710191238a93b9dde161c (patch) (unidiff)
treed050483742d0e102e08138bcdd8f170a9558b12d /core/apps/textedit
parent3f261fa6eac46b8d0d4ac8b8bb95b385435004da (diff)
downloadopie-6582895befc98131430710191238a93b9dde161c.zip
opie-6582895befc98131430710191238a93b9dde161c.tar.gz
opie-6582895befc98131430710191238a93b9dde161c.tar.bz2
QPEApplication::showDialog() and QPEAPplication::execDialog() for better big screen handling
Diffstat (limited to 'core/apps/textedit') (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/textedit/textedit.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp
index be18140..1299fe3 100644
--- a/core/apps/textedit/textedit.cpp
+++ b/core/apps/textedit/textedit.cpp
@@ -921,50 +921,49 @@ bool TextEdit::saveAs() {
921 currentFileName=fi.fileName(); 921 currentFileName=fi.fileName();
922 if(doc) 922 if(doc)
923// QString file = doc->file(); 923// QString file = doc->file();
924// doc->removeFiles(); 924// doc->removeFiles();
925 delete doc; 925 delete doc;
926 DocLnk nf; 926 DocLnk nf;
927 nf.setType("text/plain"); 927 nf.setType("text/plain");
928 nf.setFile( fileNm); 928 nf.setFile( fileNm);
929 doc = new DocLnk(nf); 929 doc = new DocLnk(nf);
930// editor->setText(rt); 930// editor->setText(rt);
931 qDebug("Saving file as "+currentFileName); 931 qDebug("Saving file as "+currentFileName);
932 doc->setName( currentFileName); 932 doc->setName( currentFileName);
933 updateCaption( currentFileName); 933 updateCaption( currentFileName);
934 934
935 FileManager fm; 935 FileManager fm;
936 if ( !fm.saveFile( *doc, rt ) ) { 936 if ( !fm.saveFile( *doc, rt ) ) {
937 return false; 937 return false;
938 } 938 }
939 939
940 if( filePerms ) { 940 if( filePerms ) {
941 filePermissions *filePerm; 941 filePermissions *filePerm;
942 filePerm = new filePermissions(this, 942 filePerm = new filePermissions(this,
943 tr("Permissions"),true, 943 tr("Permissions"),true,
944 0,(const QString &)fileNm); 944 0,(const QString &)fileNm);
945 filePerm->showMaximized(); 945 QPEApplication::execDialog( filePerm );
946 filePerm->exec();
947 946
948 if( filePerm) 947 if( filePerm)
949 delete filePerm; 948 delete filePerm;
950 } 949 }
951// } 950// }
952 editor->setEdited( false); 951 editor->setEdited( false);
953 edited1 = false; 952 edited1 = false;
954 edited = false; 953 edited = false;
955 if(caption().left(1)=="*") 954 if(caption().left(1)=="*")
956 setCaption(caption().right(caption().length()-1)); 955 setCaption(caption().right(caption().length()-1));
957 956
958 return true; 957 return true;
959 } 958 }
960 qDebug("returning false"); 959 qDebug("returning false");
961 return false; 960 return false;
962} //end saveAs 961} //end saveAs
963 962
964void TextEdit::clear() { 963void TextEdit::clear() {
965 delete doc; 964 delete doc;
966 doc = 0; 965 doc = 0;
967 editor->clear(); 966 editor->clear();
968} 967}
969 968
970void TextEdit::updateCaption( const QString &name ) { 969void TextEdit::updateCaption( const QString &name ) {
@@ -995,50 +994,49 @@ void TextEdit::setDocument(const QString& fileref) {
995 openDotFile(currentFileName); 994 openDotFile(currentFileName);
996 995
997 } else { 996 } else {
998 qDebug("setDoc open"); 997 qDebug("setDoc open");
999 bFromDocView = true; 998 bFromDocView = true;
1000 openFile(fileref); 999 openFile(fileref);
1001 editor->setEdited(true); 1000 editor->setEdited(true);
1002 edited1=false; 1001 edited1=false;
1003 edited=true; 1002 edited=true;
1004 // fromSetDocument=false; 1003 // fromSetDocument=false;
1005 // doSearchBar(); 1004 // doSearchBar();
1006 } 1005 }
1007 } 1006 }
1008 updateCaption( currentFileName); 1007 updateCaption( currentFileName);
1009} 1008}
1010 1009
1011void TextEdit::changeFont() { 1010void TextEdit::changeFont() {
1012 QDialog *d = new QDialog ( this, "FontDialog", true ); 1011 QDialog *d = new QDialog ( this, "FontDialog", true );
1013 d-> setCaption ( tr( "Choose font" )); 1012 d-> setCaption ( tr( "Choose font" ));
1014 QBoxLayout *lay = new QVBoxLayout ( d ); 1013 QBoxLayout *lay = new QVBoxLayout ( d );
1015 OFontSelector *ofs = new OFontSelector ( true, d ); 1014 OFontSelector *ofs = new OFontSelector ( true, d );
1016 lay-> addWidget ( ofs ); 1015 lay-> addWidget ( ofs );
1017 ofs-> setSelectedFont ( editor-> font ( )); 1016 ofs-> setSelectedFont ( editor-> font ( ));
1018 1017
1019 d-> showMaximized ( ); 1018 if ( QPEApplication::execDialog( d ) == QDialog::Accepted )
1020 if ( d-> exec ( ) == QDialog::Accepted )
1021 editor-> setFont ( ofs-> selectedFont ( )); 1019 editor-> setFont ( ofs-> selectedFont ( ));
1022 delete d; 1020 delete d;
1023 1021
1024} 1022}
1025 1023
1026void TextEdit::editDelete() { 1024void TextEdit::editDelete() {
1027 switch ( QMessageBox::warning(this,tr("Text Editor"), 1025 switch ( QMessageBox::warning(this,tr("Text Editor"),
1028 tr("Do you really want<BR>to <B>delete</B> " 1026 tr("Do you really want<BR>to <B>delete</B> "
1029 "the current file\nfrom the disk?<BR>This is " 1027 "the current file\nfrom the disk?<BR>This is "
1030 "<B>irreversable!</B>"), 1028 "<B>irreversable!</B>"),
1031 tr("Yes"),tr("No"),0,0,1) ) { 1029 tr("Yes"),tr("No"),0,0,1) ) {
1032 case 0: 1030 case 0:
1033 if(doc) { 1031 if(doc) {
1034 doc->removeFiles(); 1032 doc->removeFiles();
1035 clear(); 1033 clear();
1036 setCaption( tr("Text Editor") ); 1034 setCaption( tr("Text Editor") );
1037 } 1035 }
1038 break; 1036 break;
1039 case 1: 1037 case 1:
1040 // exit 1038 // exit
1041 break; 1039 break;
1042 }; 1040 };
1043} 1041}
1044 1042