author | ar <ar> | 2004-02-07 23:52:31 (UTC) |
---|---|---|
committer | ar <ar> | 2004-02-07 23:52:31 (UTC) |
commit | 6582895befc98131430710191238a93b9dde161c (patch) (unidiff) | |
tree | d050483742d0e102e08138bcdd8f170a9558b12d /core/apps | |
parent | 3f261fa6eac46b8d0d4ac8b8bb95b385435004da (diff) | |
download | opie-6582895befc98131430710191238a93b9dde161c.zip opie-6582895befc98131430710191238a93b9dde161c.tar.gz opie-6582895befc98131430710191238a93b9dde161c.tar.bz2 |
QPEApplication::showDialog() and QPEAPplication::execDialog() for better big screen handling
-rw-r--r-- | core/apps/embeddedkonsole/konsole.cpp | 5 | ||||
-rw-r--r-- | core/apps/textedit/textedit.cpp | 6 |
2 files changed, 5 insertions, 6 deletions
diff --git a/core/apps/embeddedkonsole/konsole.cpp b/core/apps/embeddedkonsole/konsole.cpp index a5adc03..ce8fb6b 100644 --- a/core/apps/embeddedkonsole/konsole.cpp +++ b/core/apps/embeddedkonsole/konsole.cpp | |||
@@ -23,51 +23,52 @@ | |||
23 | 23 | ||
24 | #include "signal.h" | 24 | #include "signal.h" |
25 | 25 | ||
26 | #include <qpe/resource.h> | 26 | #include <qpe/resource.h> |
27 | 27 | ||
28 | #include <qdir.h> | 28 | #include <qdir.h> |
29 | #include <qevent.h> | 29 | #include <qevent.h> |
30 | #include <qdragobject.h> | 30 | #include <qdragobject.h> |
31 | #include <qobjectlist.h> | 31 | #include <qobjectlist.h> |
32 | #include <qtoolbutton.h> | 32 | #include <qtoolbutton.h> |
33 | #include <qtoolbar.h> | 33 | #include <qtoolbar.h> |
34 | #include <qpushbutton.h> | 34 | #include <qpushbutton.h> |
35 | #include <qfontdialog.h> | 35 | #include <qfontdialog.h> |
36 | #include <qglobal.h> | 36 | #include <qglobal.h> |
37 | #include <qpainter.h> | 37 | #include <qpainter.h> |
38 | #include <qmenubar.h> | 38 | #include <qmenubar.h> |
39 | #include <qmessagebox.h> | 39 | #include <qmessagebox.h> |
40 | #include <qaction.h> | 40 | #include <qaction.h> |
41 | #include <qapplication.h> | 41 | #include <qapplication.h> |
42 | #include <qfontmetrics.h> | 42 | #include <qfontmetrics.h> |
43 | #include <qcombobox.h> | 43 | #include <qcombobox.h> |
44 | #include <qevent.h> | 44 | #include <qevent.h> |
45 | #include <qtabwidget.h> | 45 | #include <qtabwidget.h> |
46 | #include <qtabbar.h> | 46 | #include <qtabbar.h> |
47 | #include <qpe/config.h> | ||
48 | #include <qstringlist.h> | 47 | #include <qstringlist.h> |
49 | #include <qpalette.h> | 48 | #include <qpalette.h> |
49 | #include <qpe/config.h> | ||
50 | #include <qpe/qpeapplication.h> | ||
50 | 51 | ||
51 | #include <unistd.h> | 52 | #include <unistd.h> |
52 | #include <pwd.h> | 53 | #include <pwd.h> |
53 | #include <sys/types.h> | 54 | #include <sys/types.h> |
54 | //#include <sys/wait.h> | 55 | //#include <sys/wait.h> |
55 | #include <stdio.h> | 56 | #include <stdio.h> |
56 | #include <stdlib.h> | 57 | #include <stdlib.h> |
57 | #include <assert.h> | 58 | #include <assert.h> |
58 | 59 | ||
59 | #include "konsole.h" | 60 | #include "konsole.h" |
60 | #include "keytrans.h" | 61 | #include "keytrans.h" |
61 | #include "commandeditdialog.h" | 62 | #include "commandeditdialog.h" |
62 | 63 | ||
63 | #ifdef QT_QWS_OPIE | 64 | #ifdef QT_QWS_OPIE |
64 | #include <opie/colorpopupmenu.h> | 65 | #include <opie/colorpopupmenu.h> |
65 | #endif | 66 | #endif |
66 | 67 | ||
67 | #include <qfontdatabase.h>// U.B. | 68 | #include <qfontdatabase.h>// U.B. |
68 | #include <qstringlist.h>// U.B. | 69 | #include <qstringlist.h>// U.B. |
69 | #include <qvaluelist.h> // U.B. | 70 | #include <qvaluelist.h> // U.B. |
70 | 71 | ||
71 | class EKNumTabBar : public QTabBar { | 72 | class EKNumTabBar : public QTabBar { |
72 | public: | 73 | public: |
73 | void numberTabs() | 74 | void numberTabs() |
@@ -1055,49 +1056,49 @@ void Konsole::editCommandListMenuSelected(int iD) | |||
1055 | commonCombo->setEditable( FALSE ); | 1056 | commonCombo->setEditable( FALSE ); |
1056 | } | 1057 | } |
1057 | } | 1058 | } |
1058 | } | 1059 | } |
1059 | if( iD == -23) { | 1060 | if( iD == -23) { |
1060 | cfg.setGroup("Commands"); | 1061 | cfg.setGroup("Commands"); |
1061 | // qDebug("enableCommandEdit"); | 1062 | // qDebug("enableCommandEdit"); |
1062 | if( !configMenu->isItemChecked(iD) ) { | 1063 | if( !configMenu->isItemChecked(iD) ) { |
1063 | commonCombo->setEditable( TRUE ); | 1064 | commonCombo->setEditable( TRUE ); |
1064 | configMenu->setItemChecked(iD,TRUE); | 1065 | configMenu->setItemChecked(iD,TRUE); |
1065 | commonCombo->setCurrentItem(0); | 1066 | commonCombo->setCurrentItem(0); |
1066 | cfg.writeEntry("EditEnabled","TRUE"); | 1067 | cfg.writeEntry("EditEnabled","TRUE"); |
1067 | } else { | 1068 | } else { |
1068 | commonCombo->setEditable( FALSE ); | 1069 | commonCombo->setEditable( FALSE ); |
1069 | configMenu->setItemChecked(iD,FALSE); | 1070 | configMenu->setItemChecked(iD,FALSE); |
1070 | cfg.writeEntry("EditEnabled","FALSE"); | 1071 | cfg.writeEntry("EditEnabled","FALSE"); |
1071 | commonCombo->setFocusPolicy(QWidget::NoFocus); | 1072 | commonCombo->setFocusPolicy(QWidget::NoFocus); |
1072 | te->setFocus(); | 1073 | te->setFocus(); |
1073 | } | 1074 | } |
1074 | } | 1075 | } |
1075 | if(iD == -24) { | 1076 | if(iD == -24) { |
1076 | // "edit commands" | 1077 | // "edit commands" |
1077 | CommandEditDialog *m = new CommandEditDialog(this); | 1078 | CommandEditDialog *m = new CommandEditDialog(this); |
1078 | connect(m,SIGNAL(commandsEdited()),this,SLOT(initCommandList())); | 1079 | connect(m,SIGNAL(commandsEdited()),this,SLOT(initCommandList())); |
1079 | m->showMaximized(); | 1080 | QPEApplication::showDialog( m ); |
1080 | } | 1081 | } |
1081 | 1082 | ||
1082 | } | 1083 | } |
1083 | 1084 | ||
1084 | // $QPEDIR/bin/qcop QPE/Application/embeddedkonsole 'setDocument(QString)' 'ssh -V' | 1085 | // $QPEDIR/bin/qcop QPE/Application/embeddedkonsole 'setDocument(QString)' 'ssh -V' |
1085 | void Konsole::setDocument( const QString &cmd) { | 1086 | void Konsole::setDocument( const QString &cmd) { |
1086 | newSession(); | 1087 | newSession(); |
1087 | TEWidget* te = getTe(); | 1088 | TEWidget* te = getTe(); |
1088 | if(cmd.find("-e", 0, TRUE) != -1) { | 1089 | if(cmd.find("-e", 0, TRUE) != -1) { |
1089 | QString cmd2; | 1090 | QString cmd2; |
1090 | cmd2=cmd.right(cmd.length()-3)+" &"; | 1091 | cmd2=cmd.right(cmd.length()-3)+" &"; |
1091 | system(cmd2.latin1()); | 1092 | system(cmd2.latin1()); |
1092 | if(startUp <= 1 && nsessions < 2) { | 1093 | if(startUp <= 1 && nsessions < 2) { |
1093 | doneSession(getTe()->currentSession, 0); | 1094 | doneSession(getTe()->currentSession, 0); |
1094 | exit(0); | 1095 | exit(0); |
1095 | } else | 1096 | } else |
1096 | doneSession(getTe()->currentSession, 0); | 1097 | doneSession(getTe()->currentSession, 0); |
1097 | } else { | 1098 | } else { |
1098 | if (te != 0) { | 1099 | if (te != 0) { |
1099 | te->emitText(cmd+"\r"); | 1100 | te->emitText(cmd+"\r"); |
1100 | } | 1101 | } |
1101 | } | 1102 | } |
1102 | startUp++; | 1103 | startUp++; |
1103 | } | 1104 | } |
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 | ||
964 | void TextEdit::clear() { | 963 | void TextEdit::clear() { |
965 | delete doc; | 964 | delete doc; |
966 | doc = 0; | 965 | doc = 0; |
967 | editor->clear(); | 966 | editor->clear(); |
968 | } | 967 | } |
969 | 968 | ||
970 | void TextEdit::updateCaption( const QString &name ) { | 969 | void 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 | ||
1011 | void TextEdit::changeFont() { | 1010 | void 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 | ||
1026 | void TextEdit::editDelete() { | 1024 | void 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 | ||