author | llornkcor <llornkcor> | 2002-02-25 05:24:43 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-02-25 05:24:43 (UTC) |
commit | 160308bc29cf01582775f73e1aca13e82c65bffd (patch) (unidiff) | |
tree | 67ebc478e5eef47e881f3f4ea330633a67df0827 | |
parent | 1bebd27631a6c9d1ab967cbb32dd4e796b3b0402 (diff) | |
download | opie-160308bc29cf01582775f73e1aca13e82c65bffd.zip opie-160308bc29cf01582775f73e1aca13e82c65bffd.tar.gz opie-160308bc29cf01582775f73e1aca13e82c65bffd.tar.bz2 |
fixed open setDoc bug
-rw-r--r-- | core/apps/textedit/Makefile.in | 6 | ||||
-rw-r--r-- | core/apps/textedit/textedit.cpp | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/core/apps/textedit/Makefile.in b/core/apps/textedit/Makefile.in index fa394d6..234965b 100644 --- a/core/apps/textedit/Makefile.in +++ b/core/apps/textedit/Makefile.in | |||
@@ -1,218 +1,216 @@ | |||
1 | ############################################################################# | 1 | ############################################################################# |
2 | 2 | ||
3 | ####### Compiler, tools and options | 3 | ####### Compiler, tools and options |
4 | 4 | ||
5 | CXX =$(SYSCONF_CXX) $(QT_CXX_MT) | 5 | CXX =$(SYSCONF_CXX) $(QT_CXX_MT) |
6 | CXXFLAGS=$(SYSCONF_CXXFLAGS_QT) $(SYSCONF_CXXFLAGS) | 6 | CXXFLAGS=$(SYSCONF_CXXFLAGS_QT) $(SYSCONF_CXXFLAGS) |
7 | CC =$(SYSCONF_CC) $(QT_C_MT) | 7 | CC =$(SYSCONF_CC) $(QT_C_MT) |
8 | CFLAGS =$(SYSCONF_CFLAGS) | 8 | CFLAGS =$(SYSCONF_CFLAGS) |
9 | INCPATH =-I$(OPIEDIR)/include | 9 | INCPATH =-I$(OPIEDIR)/include |
10 | LFLAGS =$(SYSCONF_LFLAGS_QT) $(SYSCONF_RPATH_QT) $(SYSCONF_LFLAGS) $(QT_LFLAGS_MT) | 10 | LFLAGS =$(SYSCONF_LFLAGS_QT) $(SYSCONF_RPATH_QT) $(SYSCONF_LFLAGS) $(QT_LFLAGS_MT) |
11 | LIBS =$(SUBLIBS) -lqpe $(SYSCONF_LIBS_QT) $(SYSCONF_LIBS) $(SYSCONF_LIBS_QTAPP) | 11 | LIBS =$(SUBLIBS) -lqpe $(SYSCONF_LIBS_QT) $(SYSCONF_LIBS) $(SYSCONF_LIBS_QTAPP) |
12 | MOC =$(SYSCONF_MOC) | 12 | MOC =$(SYSCONF_MOC) |
13 | UIC =$(SYSCONF_UIC) | 13 | UIC =$(SYSCONF_UIC) |
14 | 14 | ||
15 | ####### Target | 15 | ####### Target |
16 | 16 | ||
17 | DESTDIR = $(OPIEDIR)/bin/ | 17 | DESTDIR = $(OPIEDIR)/bin/ |
18 | VER_MAJ = 1 | 18 | VER_MAJ = 1 |
19 | VER_MIN = 0 | 19 | VER_MIN = 0 |
20 | VER_PATCH = 0 | 20 | VER_PATCH = 0 |
21 | TARGET= textedit | 21 | TARGET= textedit |
22 | TARGET1 = lib$(TARGET).so.$(VER_MAJ) | 22 | TARGET1 = lib$(TARGET).so.$(VER_MAJ) |
23 | 23 | ||
24 | ####### Files | 24 | ####### Files |
25 | 25 | ||
26 | HEADERS =textedit.h \ | 26 | HEADERS =textedit.h \ |
27 | fileBrowser.h \ | 27 | fileBrowser.h \ |
28 | fontDialog.h \ | 28 | fontDialog.h \ |
29 | fileSaver.h \ | 29 | fileSaver.h \ |
30 | filePermissions.h | 30 | filePermissions.h |
31 | SOURCES =main.cpp \ | 31 | SOURCES =main.cpp \ |
32 | textedit.cpp \ | 32 | textedit.cpp \ |
33 | fileBrowser.cpp \ | 33 | fileBrowser.cpp \ |
34 | fontDialog.cpp \ | 34 | fontDialog.cpp \ |
35 | fileSaver.cpp \ | 35 | fileSaver.cpp \ |
36 | filePermissions.cpp | 36 | filePermissions.cpp |
37 | OBJECTS =main.o \ | 37 | OBJECTS =main.o \ |
38 | textedit.o \ | 38 | textedit.o \ |
39 | fileBrowser.o \ | 39 | fileBrowser.o \ |
40 | fontDialog.o \ | 40 | fontDialog.o \ |
41 | fileSaver.o \ | 41 | fileSaver.o \ |
42 | filePermissions.o | 42 | filePermissions.o |
43 | INTERFACES = | 43 | INTERFACES = |
44 | UICDECLS = | 44 | UICDECLS = |
45 | UICIMPLS = | 45 | UICIMPLS = |
46 | SRCMOC =moc_textedit.cpp \ | 46 | SRCMOC =moc_textedit.cpp \ |
47 | moc_fileBrowser.cpp \ | 47 | moc_fileBrowser.cpp \ |
48 | moc_fontDialog.cpp \ | 48 | moc_fontDialog.cpp \ |
49 | moc_fileSaver.cpp \ | 49 | moc_fileSaver.cpp \ |
50 | moc_filePermissions.cpp | 50 | moc_filePermissions.cpp |
51 | OBJMOC =moc_textedit.o \ | 51 | OBJMOC =moc_textedit.o \ |
52 | moc_fileBrowser.o \ | 52 | moc_fileBrowser.o \ |
53 | moc_fontDialog.o \ | 53 | moc_fontDialog.o \ |
54 | moc_fileSaver.o \ | 54 | moc_fileSaver.o \ |
55 | moc_filePermissions.o | 55 | moc_filePermissions.o |
56 | 56 | ||
57 | 57 | ||
58 | ####### Implicit rules | 58 | ####### Implicit rules |
59 | 59 | ||
60 | .SUFFIXES: .cpp .cxx .cc .C .c | 60 | .SUFFIXES: .cpp .cxx .cc .C .c |
61 | 61 | ||
62 | .cpp.o: | 62 | .cpp.o: |
63 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | 63 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< |
64 | 64 | ||
65 | .cxx.o: | 65 | .cxx.o: |
66 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | 66 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< |
67 | 67 | ||
68 | .cc.o: | 68 | .cc.o: |
69 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | 69 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< |
70 | 70 | ||
71 | .C.o: | 71 | .C.o: |
72 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | 72 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< |
73 | 73 | ||
74 | .c.o: | 74 | .c.o: |
75 | $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< | 75 | $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< |
76 | 76 | ||
77 | ####### Build rules | 77 | ####### Build rules |
78 | 78 | ||
79 | 79 | ||
80 | all: $(DESTDIR)$(TARGET) | 80 | all: $(DESTDIR)$(TARGET) |
81 | 81 | ||
82 | $(DESTDIR)$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) | 82 | $(DESTDIR)$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) |
83 | $(SYSCONF_LINK) $(LFLAGS) -o $(DESTDIR)$(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS) | 83 | $(SYSCONF_LINK) $(LFLAGS) -o $(DESTDIR)$(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS) |
84 | 84 | ||
85 | moc: $(SRCMOC) | 85 | moc: $(SRCMOC) |
86 | 86 | ||
87 | tmake: Makefile.in | 87 | tmake: |
88 | 88 | tmake textedit.pro | |
89 | Makefile.in: textedit.pro | ||
90 | tmake textedit.pro -o Makefile.in | ||
91 | 89 | ||
92 | clean: | 90 | clean: |
93 | -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) | 91 | -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) |
94 | -rm -f *~ core | 92 | -rm -f *~ core |
95 | -rm -f allmoc.cpp | 93 | -rm -f allmoc.cpp |
96 | 94 | ||
97 | ####### Extension Modules | 95 | ####### Extension Modules |
98 | 96 | ||
99 | listpromodules: | 97 | listpromodules: |
100 | @echo | 98 | @echo |
101 | 99 | ||
102 | listallmodules: | 100 | listallmodules: |
103 | @echo | 101 | @echo |
104 | 102 | ||
105 | listaddonpromodules: | 103 | listaddonpromodules: |
106 | @echo | 104 | @echo |
107 | 105 | ||
108 | listaddonentmodules: | 106 | listaddonentmodules: |
109 | @echo | 107 | @echo |
110 | 108 | ||
111 | 109 | ||
112 | REQUIRES= | 110 | REQUIRES= |
113 | 111 | ||
114 | ####### Sub-libraries | 112 | ####### Sub-libraries |
115 | 113 | ||
116 | 114 | ||
117 | ###### Combined headers | 115 | ###### Combined headers |
118 | 116 | ||
119 | 117 | ||
120 | 118 | ||
121 | ####### Compile | 119 | ####### Compile |
122 | 120 | ||
123 | main.o: main.cpp \ | 121 | main.o: main.cpp \ |
124 | textedit.h \ | 122 | textedit.h \ |
125 | fileBrowser.h \ | 123 | fileBrowser.h \ |
126 | fileSaver.h \ | 124 | fileSaver.h \ |
127 | $(OPIEDIR)/include/qpe/filemanager.h \ | 125 | $(OPIEDIR)/include/qpe/filemanager.h \ |
128 | $(OPIEDIR)/include/qpe/qpeapplication.h \ | 126 | $(OPIEDIR)/include/qpe/qpeapplication.h \ |
129 | $(OPIEDIR)/include/qpedecoration_qws.h \ | 127 | $(OPIEDIR)/include/qpedecoration_qws.h \ |
130 | $(OPIEDIR)/include/timestring.h | 128 | $(OPIEDIR)/include/timestring.h |
131 | 129 | ||
132 | textedit.o: textedit.cpp \ | 130 | textedit.o: textedit.cpp \ |
133 | textedit.h \ | 131 | textedit.h \ |
134 | fileBrowser.h \ | 132 | fileBrowser.h \ |
135 | fileSaver.h \ | 133 | fileSaver.h \ |
136 | $(OPIEDIR)/include/qpe/filemanager.h \ | 134 | $(OPIEDIR)/include/qpe/filemanager.h \ |
137 | filePermissions.h \ | 135 | filePermissions.h \ |
138 | fontDialog.h \ | 136 | fontDialog.h \ |
139 | $(OPIEDIR)/include/qpe/fontdatabase.h \ | 137 | $(OPIEDIR)/include/qpe/fontdatabase.h \ |
140 | $(OPIEDIR)/include/qpe/fontfactoryinterface.h \ | 138 | $(OPIEDIR)/include/qpe/fontfactoryinterface.h \ |
141 | $(OPIEDIR)/include/qpe/qcom.h \ | 139 | $(OPIEDIR)/include/qpe/qcom.h \ |
142 | $(OPIEDIR)/include/qpe/quuid.h \ | 140 | $(OPIEDIR)/include/qpe/quuid.h \ |
143 | $(OPIEDIR)/include/qpe/global.h \ | 141 | $(OPIEDIR)/include/qpe/global.h \ |
144 | $(OPIEDIR)/include/qpe/fileselector.h \ | 142 | $(OPIEDIR)/include/qpe/fileselector.h \ |
145 | $(OPIEDIR)/include/filemanager.h \ | 143 | $(OPIEDIR)/include/filemanager.h \ |
146 | $(OPIEDIR)/include/applnk.h \ | 144 | $(OPIEDIR)/include/applnk.h \ |
147 | $(OPIEDIR)/include/qpe/applnk.h \ | 145 | $(OPIEDIR)/include/qpe/applnk.h \ |
148 | $(OPIEDIR)/include/qpe/resource.h \ | 146 | $(OPIEDIR)/include/qpe/resource.h \ |
149 | $(OPIEDIR)/include/qpe/config.h \ | 147 | $(OPIEDIR)/include/qpe/config.h \ |
150 | $(OPIEDIR)/include/qpe/qpeapplication.h \ | 148 | $(OPIEDIR)/include/qpe/qpeapplication.h \ |
151 | $(OPIEDIR)/include/qpedecoration_qws.h \ | 149 | $(OPIEDIR)/include/qpedecoration_qws.h \ |
152 | $(OPIEDIR)/include/timestring.h \ | 150 | $(OPIEDIR)/include/timestring.h \ |
153 | $(OPIEDIR)/include/qpe/qpemenubar.h \ | 151 | $(OPIEDIR)/include/qpe/qpemenubar.h \ |
154 | $(OPIEDIR)/include/qpe/qpetoolbar.h | 152 | $(OPIEDIR)/include/qpe/qpetoolbar.h |
155 | 153 | ||
156 | fileBrowser.o: fileBrowser.cpp \ | 154 | fileBrowser.o: fileBrowser.cpp \ |
157 | fileBrowser.h \ | 155 | fileBrowser.h \ |
158 | $(OPIEDIR)/include/qpe/config.h | 156 | $(OPIEDIR)/include/qpe/config.h |
159 | 157 | ||
160 | fontDialog.o: fontDialog.cpp \ | 158 | fontDialog.o: fontDialog.cpp \ |
161 | fontDialog.h \ | 159 | fontDialog.h \ |
162 | $(OPIEDIR)/include/qpe/fontdatabase.h \ | 160 | $(OPIEDIR)/include/qpe/fontdatabase.h \ |
163 | $(OPIEDIR)/include/qpe/fontfactoryinterface.h \ | 161 | $(OPIEDIR)/include/qpe/fontfactoryinterface.h \ |
164 | $(OPIEDIR)/include/qpe/qcom.h \ | 162 | $(OPIEDIR)/include/qpe/qcom.h \ |
165 | $(OPIEDIR)/include/qpe/quuid.h \ | 163 | $(OPIEDIR)/include/qpe/quuid.h \ |
166 | $(OPIEDIR)/include/qpe/config.h \ | 164 | $(OPIEDIR)/include/qpe/config.h \ |
167 | $(OPIEDIR)/include/qpe/qpeapplication.h \ | 165 | $(OPIEDIR)/include/qpe/qpeapplication.h \ |
168 | $(OPIEDIR)/include/qpedecoration_qws.h \ | 166 | $(OPIEDIR)/include/qpedecoration_qws.h \ |
169 | $(OPIEDIR)/include/timestring.h | 167 | $(OPIEDIR)/include/timestring.h |
170 | 168 | ||
171 | fileSaver.o: fileSaver.cpp \ | 169 | fileSaver.o: fileSaver.cpp \ |
172 | fileSaver.h \ | 170 | fileSaver.h \ |
173 | $(OPIEDIR)/include/qpe/config.h \ | 171 | $(OPIEDIR)/include/qpe/config.h \ |
174 | $(OPIEDIR)/include/qpe/qpeapplication.h \ | 172 | $(OPIEDIR)/include/qpe/qpeapplication.h \ |
175 | $(OPIEDIR)/include/qpedecoration_qws.h \ | 173 | $(OPIEDIR)/include/qpedecoration_qws.h \ |
176 | $(OPIEDIR)/include/timestring.h | 174 | $(OPIEDIR)/include/timestring.h |
177 | 175 | ||
178 | filePermissions.o: filePermissions.cpp \ | 176 | filePermissions.o: filePermissions.cpp \ |
179 | filePermissions.h | 177 | filePermissions.h |
180 | 178 | ||
181 | moc_textedit.o: moc_textedit.cpp \ | 179 | moc_textedit.o: moc_textedit.cpp \ |
182 | textedit.h \ | 180 | textedit.h \ |
183 | fileBrowser.h \ | 181 | fileBrowser.h \ |
184 | fileSaver.h \ | 182 | fileSaver.h \ |
185 | $(OPIEDIR)/include/qpe/filemanager.h | 183 | $(OPIEDIR)/include/qpe/filemanager.h |
186 | 184 | ||
187 | moc_fileBrowser.o: moc_fileBrowser.cpp \ | 185 | moc_fileBrowser.o: moc_fileBrowser.cpp \ |
188 | fileBrowser.h | 186 | fileBrowser.h |
189 | 187 | ||
190 | moc_fontDialog.o: moc_fontDialog.cpp \ | 188 | moc_fontDialog.o: moc_fontDialog.cpp \ |
191 | fontDialog.h \ | 189 | fontDialog.h \ |
192 | $(OPIEDIR)/include/qpe/fontdatabase.h \ | 190 | $(OPIEDIR)/include/qpe/fontdatabase.h \ |
193 | $(OPIEDIR)/include/qpe/fontfactoryinterface.h \ | 191 | $(OPIEDIR)/include/qpe/fontfactoryinterface.h \ |
194 | $(OPIEDIR)/include/qpe/qcom.h \ | 192 | $(OPIEDIR)/include/qpe/qcom.h \ |
195 | $(OPIEDIR)/include/qpe/quuid.h | 193 | $(OPIEDIR)/include/qpe/quuid.h |
196 | 194 | ||
197 | moc_fileSaver.o: moc_fileSaver.cpp \ | 195 | moc_fileSaver.o: moc_fileSaver.cpp \ |
198 | fileSaver.h | 196 | fileSaver.h |
199 | 197 | ||
200 | moc_filePermissions.o: moc_filePermissions.cpp \ | 198 | moc_filePermissions.o: moc_filePermissions.cpp \ |
201 | filePermissions.h | 199 | filePermissions.h |
202 | 200 | ||
203 | moc_textedit.cpp: textedit.h | 201 | moc_textedit.cpp: textedit.h |
204 | $(MOC) textedit.h -o moc_textedit.cpp | 202 | $(MOC) textedit.h -o moc_textedit.cpp |
205 | 203 | ||
206 | moc_fileBrowser.cpp: fileBrowser.h | 204 | moc_fileBrowser.cpp: fileBrowser.h |
207 | $(MOC) fileBrowser.h -o moc_fileBrowser.cpp | 205 | $(MOC) fileBrowser.h -o moc_fileBrowser.cpp |
208 | 206 | ||
209 | moc_fontDialog.cpp: fontDialog.h | 207 | moc_fontDialog.cpp: fontDialog.h |
210 | $(MOC) fontDialog.h -o moc_fontDialog.cpp | 208 | $(MOC) fontDialog.h -o moc_fontDialog.cpp |
211 | 209 | ||
212 | moc_fileSaver.cpp: fileSaver.h | 210 | moc_fileSaver.cpp: fileSaver.h |
213 | $(MOC) fileSaver.h -o moc_fileSaver.cpp | 211 | $(MOC) fileSaver.h -o moc_fileSaver.cpp |
214 | 212 | ||
215 | moc_filePermissions.cpp: filePermissions.h | 213 | moc_filePermissions.cpp: filePermissions.h |
216 | $(MOC) filePermissions.h -o moc_filePermissions.cpp | 214 | $(MOC) filePermissions.h -o moc_filePermissions.cpp |
217 | 215 | ||
218 | 216 | ||
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp index 603f032..bc975f3 100644 --- a/core/apps/textedit/textedit.cpp +++ b/core/apps/textedit/textedit.cpp | |||
@@ -451,446 +451,448 @@ void TextEdit::setFontSize(int sz, bool round_down_not_up) | |||
451 | } else if ( round_down_not_up ) { | 451 | } else if ( round_down_not_up ) { |
452 | if ( fontsize[i] < sz ) | 452 | if ( fontsize[i] < sz ) |
453 | s = fontsize[i]; | 453 | s = fontsize[i]; |
454 | } else { | 454 | } else { |
455 | if ( fontsize[i] > sz ) { | 455 | if ( fontsize[i] > sz ) { |
456 | s = fontsize[i]; | 456 | s = fontsize[i]; |
457 | break; | 457 | break; |
458 | } | 458 | } |
459 | } | 459 | } |
460 | } | 460 | } |
461 | 461 | ||
462 | QFont f = editor->font(); | 462 | QFont f = editor->font(); |
463 | f.setPointSize(s); | 463 | f.setPointSize(s); |
464 | editor->setFont(f); | 464 | editor->setFont(f); |
465 | 465 | ||
466 | zin->setEnabled(s != fontsize[nfontsizes-1]); | 466 | zin->setEnabled(s != fontsize[nfontsizes-1]); |
467 | zout->setEnabled(s != fontsize[0]); | 467 | zout->setEnabled(s != fontsize[0]); |
468 | } | 468 | } |
469 | 469 | ||
470 | void TextEdit::setBold(bool y) | 470 | void TextEdit::setBold(bool y) |
471 | { | 471 | { |
472 | QFont f = editor->font(); | 472 | QFont f = editor->font(); |
473 | f.setBold(y); | 473 | f.setBold(y); |
474 | editor->setFont(f); | 474 | editor->setFont(f); |
475 | } | 475 | } |
476 | 476 | ||
477 | void TextEdit::setItalic(bool y) | 477 | void TextEdit::setItalic(bool y) |
478 | { | 478 | { |
479 | QFont f = editor->font(); | 479 | QFont f = editor->font(); |
480 | f.setItalic(y); | 480 | f.setItalic(y); |
481 | editor->setFont(f); | 481 | editor->setFont(f); |
482 | } | 482 | } |
483 | 483 | ||
484 | void TextEdit::setWordWrap(bool y) | 484 | void TextEdit::setWordWrap(bool y) |
485 | { | 485 | { |
486 | bool state = editor->edited(); | 486 | bool state = editor->edited(); |
487 | editor->setWordWrap(y ? QMultiLineEdit::WidgetWidth : QMultiLineEdit::NoWrap ); | 487 | editor->setWordWrap(y ? QMultiLineEdit::WidgetWidth : QMultiLineEdit::NoWrap ); |
488 | editor->setEdited( state ); | 488 | editor->setEdited( state ); |
489 | } | 489 | } |
490 | 490 | ||
491 | void TextEdit::fileNew() | 491 | void TextEdit::fileNew() |
492 | { | 492 | { |
493 | if( !bFromDocView ) { | 493 | if( !bFromDocView ) { |
494 | saveAs(); | 494 | saveAs(); |
495 | } | 495 | } |
496 | newFile(DocLnk()); | 496 | newFile(DocLnk()); |
497 | } | 497 | } |
498 | 498 | ||
499 | void TextEdit::fileOpen() | 499 | void TextEdit::fileOpen() |
500 | { | 500 | { |
501 | // if ( !save() ) { | 501 | // if ( !save() ) { |
502 | // if ( QMessageBox::critical( this, tr( "Out of space" ), | 502 | // if ( QMessageBox::critical( this, tr( "Out of space" ), |
503 | // tr( "Text Editor was unable to\n" | 503 | // tr( "Text Editor was unable to\n" |
504 | // "save your changes.\n" | 504 | // "save your changes.\n" |
505 | // "Free some space and try again.\n" | 505 | // "Free some space and try again.\n" |
506 | // "\nContinue anyway?" ), | 506 | // "\nContinue anyway?" ), |
507 | // QMessageBox::Yes|QMessageBox::Escape, | 507 | // QMessageBox::Yes|QMessageBox::Escape, |
508 | // QMessageBox::No|QMessageBox::Default ) | 508 | // QMessageBox::No|QMessageBox::Default ) |
509 | // != QMessageBox::Yes ) | 509 | // != QMessageBox::Yes ) |
510 | // return; | 510 | // return; |
511 | // else { | 511 | // else { |
512 | // delete doc; | 512 | // delete doc; |
513 | // doc = 0; | 513 | // doc = 0; |
514 | // } | 514 | // } |
515 | // } | 515 | // } |
516 | menu->hide(); | 516 | menu->hide(); |
517 | editBar->hide(); | 517 | editBar->hide(); |
518 | searchBar->hide(); | 518 | searchBar->hide(); |
519 | clearWState (WState_Reserved1 ); | 519 | clearWState (WState_Reserved1 ); |
520 | editorStack->raiseWidget( fileSelector ); | 520 | editorStack->raiseWidget( fileSelector ); |
521 | fileSelector->reread(); | 521 | fileSelector->reread(); |
522 | updateCaption(); | 522 | updateCaption(); |
523 | } | 523 | } |
524 | 524 | ||
525 | void TextEdit::newFileOpen() | 525 | void TextEdit::newFileOpen() |
526 | { | 526 | { |
527 | browseForFiles=new fileBrowser(this,"fileBrowser",TRUE,0, "*"); | 527 | browseForFiles=new fileBrowser(this,"fileBrowser",TRUE,0, "*"); |
528 | if( browseForFiles->exec() != -1 ) { | 528 | if( browseForFiles->exec() != -1 ) { |
529 | QString selFile= browseForFiles->selectedFileName; | 529 | QString selFile= browseForFiles->selectedFileName; |
530 | QStringList fileList=browseForFiles->fileList; | 530 | QStringList fileList=browseForFiles->fileList; |
531 | qDebug(selFile); | 531 | qDebug(selFile); |
532 | QStringList::ConstIterator f; | 532 | QStringList::ConstIterator f; |
533 | QString fileTemp; | 533 | QString fileTemp; |
534 | for ( f = fileList.begin(); f != fileList.end(); f++ ) { | 534 | for ( f = fileList.begin(); f != fileList.end(); f++ ) { |
535 | fileTemp = *f; | 535 | fileTemp = *f; |
536 | fileTemp.right( fileTemp.length()-5); | 536 | fileTemp.right( fileTemp.length()-5); |
537 | QString fileName = fileTemp; | 537 | QString fileName = fileTemp; |
538 | if( fileName != "Unnamed" || fileName != "Empty Text" ) { | 538 | if( fileName != "Unnamed" || fileName != "Empty Text" ) { |
539 | currentFileName = fileName; | 539 | currentFileName = fileName; |
540 | qDebug("please open "+currentFileName); | 540 | qDebug("please open "+currentFileName); |
541 | openFile(fileName ); | 541 | openFile(fileName ); |
542 | } | 542 | } |
543 | } | 543 | } |
544 | } | 544 | } |
545 | delete browseForFiles; | 545 | delete browseForFiles; |
546 | editor->setEdited( true ); | 546 | editor->setEdited( true ); |
547 | } | 547 | } |
548 | 548 | ||
549 | #if 0 | 549 | #if 0 |
550 | void TextEdit::slotFind() | 550 | void TextEdit::slotFind() |
551 | { | 551 | { |
552 | FindDialog frmFind( "Text Editor", this ); | 552 | FindDialog frmFind( "Text Editor", this ); |
553 | connect( &frmFind, SIGNAL(signalFindClicked(const QString &, bool, bool, int)), | 553 | connect( &frmFind, SIGNAL(signalFindClicked(const QString &, bool, bool, int)), |
554 | editor, SLOT(slotDoFind( const QString&,bool,bool))); | 554 | editor, SLOT(slotDoFind( const QString&,bool,bool))); |
555 | 555 | ||
556 | //case sensitive, backwards, [category] | 556 | //case sensitive, backwards, [category] |
557 | 557 | ||
558 | connect( editor, SIGNAL(notFound()), | 558 | connect( editor, SIGNAL(notFound()), |
559 | &frmFind, SLOT(slotNotFound()) ); | 559 | &frmFind, SLOT(slotNotFound()) ); |
560 | connect( editor, SIGNAL(searchWrapped()), | 560 | connect( editor, SIGNAL(searchWrapped()), |
561 | &frmFind, SLOT(slotWrapAround()) ); | 561 | &frmFind, SLOT(slotWrapAround()) ); |
562 | 562 | ||
563 | frmFind.exec(); | 563 | frmFind.exec(); |
564 | 564 | ||
565 | 565 | ||
566 | } | 566 | } |
567 | #endif | 567 | #endif |
568 | 568 | ||
569 | void TextEdit::fileRevert() | 569 | void TextEdit::fileRevert() |
570 | { | 570 | { |
571 | clear(); | 571 | clear(); |
572 | fileOpen(); | 572 | fileOpen(); |
573 | } | 573 | } |
574 | 574 | ||
575 | void TextEdit::editCut() | 575 | void TextEdit::editCut() |
576 | { | 576 | { |
577 | #ifndef QT_NO_CLIPBOARD | 577 | #ifndef QT_NO_CLIPBOARD |
578 | editor->cut(); | 578 | editor->cut(); |
579 | #endif | 579 | #endif |
580 | } | 580 | } |
581 | 581 | ||
582 | void TextEdit::editCopy() | 582 | void TextEdit::editCopy() |
583 | { | 583 | { |
584 | #ifndef QT_NO_CLIPBOARD | 584 | #ifndef QT_NO_CLIPBOARD |
585 | editor->copy(); | 585 | editor->copy(); |
586 | #endif | 586 | #endif |
587 | } | 587 | } |
588 | 588 | ||
589 | void TextEdit::editPaste() | 589 | void TextEdit::editPaste() |
590 | { | 590 | { |
591 | #ifndef QT_NO_CLIPBOARD | 591 | #ifndef QT_NO_CLIPBOARD |
592 | editor->paste(); | 592 | editor->paste(); |
593 | #endif | 593 | #endif |
594 | } | 594 | } |
595 | 595 | ||
596 | void TextEdit::editFind() | 596 | void TextEdit::editFind() |
597 | { | 597 | { |
598 | searchBar->show(); | 598 | searchBar->show(); |
599 | searchVisible = TRUE; | 599 | searchVisible = TRUE; |
600 | searchEdit->setFocus(); | 600 | searchEdit->setFocus(); |
601 | } | 601 | } |
602 | 602 | ||
603 | void TextEdit::findNext() | 603 | void TextEdit::findNext() |
604 | { | 604 | { |
605 | editor->find( searchEdit->text(), FALSE, FALSE ); | 605 | editor->find( searchEdit->text(), FALSE, FALSE ); |
606 | 606 | ||
607 | } | 607 | } |
608 | 608 | ||
609 | void TextEdit::findClose() | 609 | void TextEdit::findClose() |
610 | { | 610 | { |
611 | searchVisible = FALSE; | 611 | searchVisible = FALSE; |
612 | searchBar->hide(); | 612 | searchBar->hide(); |
613 | } | 613 | } |
614 | 614 | ||
615 | void TextEdit::search() | 615 | void TextEdit::search() |
616 | { | 616 | { |
617 | editor->find( searchEdit->text(), FALSE, FALSE ); | 617 | editor->find( searchEdit->text(), FALSE, FALSE ); |
618 | } | 618 | } |
619 | 619 | ||
620 | void TextEdit::newFile( const DocLnk &f ) | 620 | void TextEdit::newFile( const DocLnk &f ) |
621 | { | 621 | { |
622 | DocLnk nf = f; | 622 | DocLnk nf = f; |
623 | nf.setType("text/plain"); | 623 | nf.setType("text/plain"); |
624 | clear(); | 624 | clear(); |
625 | editorStack->raiseWidget( editor ); | 625 | editorStack->raiseWidget( editor ); |
626 | setWState (WState_Reserved1 ); | 626 | setWState (WState_Reserved1 ); |
627 | editor->setFocus(); | 627 | editor->setFocus(); |
628 | doc = new DocLnk(nf); | 628 | doc = new DocLnk(nf); |
629 | qDebug("newFile "+currentFileName); | 629 | qDebug("newFile "+currentFileName); |
630 | updateCaption(currentFileName); | 630 | updateCaption(currentFileName); |
631 | } | 631 | } |
632 | 632 | ||
633 | void TextEdit::openFile( const QString &f ) | 633 | void TextEdit::openFile( const QString &f ) |
634 | { | 634 | { |
635 | bFromDocView = TRUE; | 635 | bFromDocView = TRUE; |
636 | DocLnk nf; | 636 | DocLnk nf; |
637 | nf.setType("text/plain"); | 637 | nf.setType("text/plain"); |
638 | nf.setFile(f); | 638 | nf.setFile(f); |
639 | currentFileName=f; | 639 | currentFileName=f; |
640 | QFileInfo fi( currentFileName); | 640 | QFileInfo fi( currentFileName); |
641 | nf.setName(fi.baseName()); | 641 | nf.setName(fi.baseName()); |
642 | qDebug("openFile string"+currentFileName); | 642 | qDebug("openFile string"+currentFileName); |
643 | 643 | ||
644 | openFile(nf); | 644 | openFile(nf); |
645 | showEditTools(); | 645 | showEditTools(); |
646 | // Show filename in caption | 646 | // Show filename in caption |
647 | QString name = f; | 647 | QString name = f; |
648 | int sep = name.findRev( '/' ); | 648 | int sep = name.findRev( '/' ); |
649 | if ( sep > 0 ) | 649 | if ( sep > 0 ) |
650 | name = name.mid( sep+1 ); | 650 | name = name.mid( sep+1 ); |
651 | updateCaption( name ); | 651 | updateCaption( name ); |
652 | } | 652 | } |
653 | 653 | ||
654 | void TextEdit::openFile( const DocLnk &f ) | 654 | void TextEdit::openFile( const DocLnk &f ) |
655 | { | 655 | { |
656 | // clear(); | 656 | // clear(); |
657 | bFromDocView = TRUE; | 657 | bFromDocView = TRUE; |
658 | FileManager fm; | 658 | FileManager fm; |
659 | QString txt; | 659 | QString txt; |
660 | currentFileName=f.name(); | 660 | currentFileName=f.name(); |
661 | qDebug("openFile doclnk " + currentFileName); | 661 | qDebug("openFile doclnk " + currentFileName); |
662 | if ( !fm.loadFile( f, txt ) ) { | 662 | if ( !fm.loadFile( f, txt ) ) { |
663 | // ####### could be a new file | 663 | // ####### could be a new file |
664 | qDebug( "Cannot open file" ); | 664 | qDebug( "Cannot open file" ); |
665 | 665 | ||
666 | //return; | 666 | //return; |
667 | } | 667 | } |
668 | 668 | ||
669 | fileNew(); | 669 | fileNew(); |
670 | if ( doc ) | 670 | if ( doc ) |
671 | delete doc; | 671 | delete doc; |
672 | doc = new DocLnk(f); | 672 | doc = new DocLnk(f); |
673 | editor->setText(txt); | 673 | editor->setText(txt); |
674 | editor->setEdited( false); | 674 | editor->setEdited( false); |
675 | qDebug("openFile doclnk "+currentFileName); | 675 | qDebug("openFile doclnk "+currentFileName); |
676 | doc->setName(currentFileName); | 676 | doc->setName(currentFileName); |
677 | updateCaption(); | 677 | updateCaption(); |
678 | } | 678 | } |
679 | 679 | ||
680 | void TextEdit::showEditTools() | 680 | void TextEdit::showEditTools() |
681 | { | 681 | { |
682 | // if ( !doc ) | 682 | // if ( !doc ) |
683 | // close(); | 683 | // close(); |
684 | // clear(); | 684 | // clear(); |
685 | fileSelector->hide(); | 685 | fileSelector->hide(); |
686 | menu->show(); | 686 | menu->show(); |
687 | editBar->show(); | 687 | editBar->show(); |
688 | if ( searchVisible ) | 688 | if ( searchVisible ) |
689 | searchBar->show(); | 689 | searchBar->show(); |
690 | // updateCaption(); | 690 | // updateCaption(); |
691 | editorStack->raiseWidget( editor ); | 691 | editorStack->raiseWidget( editor ); |
692 | setWState (WState_Reserved1 ); | 692 | setWState (WState_Reserved1 ); |
693 | } | 693 | } |
694 | 694 | ||
695 | /*! | 695 | /*! |
696 | unprompted save */ | 696 | unprompted save */ |
697 | bool TextEdit::save() | 697 | bool TextEdit::save() |
698 | { | 698 | { |
699 | QString file = doc->file(); | 699 | QString file = doc->file(); |
700 | QString name= doc->name(); | 700 | QString name= doc->name(); |
701 | 701 | ||
702 | QString rt = editor->text(); | 702 | QString rt = editor->text(); |
703 | currentFileName= name ; | 703 | currentFileName= name ; |
704 | qDebug("saveFile "+currentFileName); | 704 | qDebug("saveFile "+currentFileName); |
705 | 705 | ||
706 | struct stat buf; | 706 | struct stat buf; |
707 | mode_t mode; | 707 | mode_t mode; |
708 | stat(file.latin1(), &buf); | 708 | stat(file.latin1(), &buf); |
709 | mode = buf.st_mode; | 709 | mode = buf.st_mode; |
710 | 710 | ||
711 | doc->setName( name); | 711 | doc->setName( name); |
712 | FileManager fm; | 712 | FileManager fm; |
713 | if ( !fm.saveFile( *doc, rt ) ) { | 713 | if ( !fm.saveFile( *doc, rt ) ) { |
714 | return false; | 714 | return false; |
715 | } | 715 | } |
716 | editor->setEdited( false ); | 716 | editor->setEdited( false ); |
717 | 717 | ||
718 | chmod( file.latin1(), mode); | 718 | chmod( file.latin1(), mode); |
719 | return true; | 719 | return true; |
720 | } | 720 | } |
721 | 721 | ||
722 | /*! | 722 | /*! |
723 | prompted save */ | 723 | prompted save */ |
724 | bool TextEdit::saveAs() | 724 | bool TextEdit::saveAs() |
725 | { | 725 | { |
726 | // qDebug("saveAsFile "+currentFileName); | 726 | // qDebug("saveAsFile "+currentFileName); |
727 | 727 | ||
728 | // case of nothing to save... /// there's always something to save | 728 | // case of nothing to save... /// there's always something to save |
729 | // if ( !doc )//|| !bFromDocView) | 729 | // if ( !doc )//|| !bFromDocView) |
730 | // { | 730 | // { |
731 | // qDebug("no doc"); | 731 | // qDebug("no doc"); |
732 | // return true; | 732 | // return true; |
733 | // } | 733 | // } |
734 | if ( !editor->edited() ) { | 734 | if ( !editor->edited() ) { |
735 | delete doc; | 735 | delete doc; |
736 | doc = 0; | 736 | doc = 0; |
737 | return true; | 737 | return true; |
738 | } | 738 | } |
739 | 739 | ||
740 | QString rt = editor->text(); | 740 | QString rt = editor->text(); |
741 | qDebug(currentFileName); | 741 | qDebug(currentFileName); |
742 | 742 | ||
743 | if( currentFileName.isEmpty() || currentFileName == "Unnamed") { | 743 | if( currentFileName.isEmpty() || currentFileName == "Unnamed") { |
744 | qDebug("do silly TT filename thing"); | 744 | qDebug("do silly TT filename thing"); |
745 | if ( doc->name().isEmpty() ) { | 745 | if ( doc->name().isEmpty() ) { |
746 | QString pt = rt.simplifyWhiteSpace(); | 746 | QString pt = rt.simplifyWhiteSpace(); |
747 | int i = pt.find( ' ' ); | 747 | int i = pt.find( ' ' ); |
748 | QString docname = pt; | 748 | QString docname = pt; |
749 | if ( i > 0 ) | 749 | if ( i > 0 ) |
750 | docname = pt.left( i ); | 750 | docname = pt.left( i ); |
751 | // remove "." at the beginning | 751 | // remove "." at the beginning |
752 | while( docname.startsWith( "." ) ) | 752 | while( docname.startsWith( "." ) ) |
753 | docname = docname.mid( 1 ); | 753 | docname = docname.mid( 1 ); |
754 | docname.replace( QRegExp("/"), "_" ); | 754 | docname.replace( QRegExp("/"), "_" ); |
755 | // cut the length. filenames longer than that don't make sense and something goes wrong when they get too long. | 755 | // cut the length. filenames longer than that don't make sense and something goes wrong when they get too long. |
756 | if ( docname.length() > 40 ) | 756 | if ( docname.length() > 40 ) |
757 | docname = docname.left(40); | 757 | docname = docname.left(40); |
758 | if ( docname.isEmpty() ) | 758 | if ( docname.isEmpty() ) |
759 | docname = "Unnamed"; | 759 | docname = "Unnamed"; |
760 | doc->setName(docname); | 760 | doc->setName(docname); |
761 | currentFileName=docname; | 761 | currentFileName=docname; |
762 | } | 762 | } |
763 | } | 763 | } |
764 | 764 | ||
765 | 765 | ||
766 | fileSaveDlg=new fileSaver(this,"SaveFile",TRUE,0, currentFileName); | 766 | fileSaveDlg=new fileSaver(this,"SaveFile",TRUE,0, currentFileName); |
767 | qDebug("wanna save filename "+currentFileName); | 767 | qDebug("wanna save filename "+currentFileName); |
768 | fileSaveDlg->exec(); | 768 | fileSaveDlg->exec(); |
769 | if( fileSaveDlg->result() == 1 ) { | 769 | if( fileSaveDlg->result() == 1 ) { |
770 | QString fileNm=fileSaveDlg->selectedFileName; | 770 | QString fileNm=fileSaveDlg->selectedFileName; |
771 | qDebug("saving filename "+fileNm); | 771 | qDebug("saving filename "+fileNm); |
772 | QFileInfo fi(fileNm); | 772 | QFileInfo fi(fileNm); |
773 | currentFileName=fi.fileName(); | 773 | currentFileName=fi.fileName(); |
774 | if(doc) { | 774 | if(doc) { |
775 | qDebug("doclnk exists"); | 775 | qDebug("doclnk exists"); |
776 | // QString file = doc->file(); | 776 | // QString file = doc->file(); |
777 | // doc->removeFiles(); | 777 | // doc->removeFiles(); |
778 | delete doc; | 778 | delete doc; |
779 | DocLnk nf; | 779 | DocLnk nf; |
780 | nf.setType("text/plain"); | 780 | nf.setType("text/plain"); |
781 | nf.setFile( fileNm); | 781 | nf.setFile( fileNm); |
782 | doc = new DocLnk(nf); | 782 | doc = new DocLnk(nf); |
783 | // editor->setText(rt); | 783 | // editor->setText(rt); |
784 | qDebug("openFile doclnk "+currentFileName); | 784 | qDebug("openFile doclnk "+currentFileName); |
785 | doc->setName( currentFileName); | 785 | doc->setName( currentFileName); |
786 | updateCaption( currentFileName); | 786 | updateCaption( currentFileName); |
787 | 787 | ||
788 | FileManager fm; | 788 | FileManager fm; |
789 | if ( !fm.saveFile( *doc, rt ) ) { | 789 | if ( !fm.saveFile( *doc, rt ) ) { |
790 | return false; | 790 | return false; |
791 | } | 791 | } |
792 | if( fileSaveDlg->filePermCheck->isChecked() ) { | 792 | if( fileSaveDlg->filePermCheck->isChecked() ) { |
793 | filePermissions *filePerm; | 793 | filePermissions *filePerm; |
794 | filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)fileNm); | 794 | filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)fileNm); |
795 | filePerm->exec(); | 795 | filePerm->exec(); |
796 | editor->setEdited( false ); | 796 | editor->setEdited( false ); |
797 | if( filePerm) | 797 | if( filePerm) |
798 | delete filePerm; | 798 | delete filePerm; |
799 | } | 799 | } |
800 | } | 800 | } |
801 | } | 801 | } |
802 | 802 | ||
803 | if(fileSaveDlg) | 803 | if(fileSaveDlg) |
804 | delete fileSaveDlg; | 804 | delete fileSaveDlg; |
805 | return true; | 805 | return true; |
806 | } | 806 | } |
807 | 807 | ||
808 | void TextEdit::clear() | 808 | void TextEdit::clear() |
809 | { | 809 | { |
810 | delete doc; | 810 | delete doc; |
811 | doc = 0; | 811 | doc = 0; |
812 | editor->clear(); | 812 | editor->clear(); |
813 | } | 813 | } |
814 | 814 | ||
815 | void TextEdit::updateCaption( const QString &name ) | 815 | void TextEdit::updateCaption( const QString &name ) |
816 | { | 816 | { |
817 | if ( !doc ) | 817 | if ( !doc ) |
818 | setCaption( tr("Text Editor") ); | 818 | setCaption( tr("Text Editor") ); |
819 | else { | 819 | else { |
820 | QString s = name; | 820 | QString s = name; |
821 | if ( s.isNull() ) | 821 | if ( s.isNull() ) |
822 | s = doc->name(); | 822 | s = doc->name(); |
823 | if ( s.isEmpty() ) { | 823 | if ( s.isEmpty() ) { |
824 | s = tr( "Unnamed" ); | 824 | s = tr( "Unnamed" ); |
825 | currentFileName=s; | 825 | currentFileName=s; |
826 | } | 826 | } |
827 | 827 | ||
828 | setCaption( s + " - " + tr("Text Editor") ); | 828 | setCaption( s + " - " + tr("Text Editor") ); |
829 | } | 829 | } |
830 | } | 830 | } |
831 | 831 | ||
832 | void TextEdit::setDocument(const QString& fileref) | 832 | void TextEdit::setDocument(const QString& fileref) |
833 | { | 833 | { |
834 | bFromDocView = TRUE; | 834 | bFromDocView = TRUE; |
835 | openFile(DocLnk(fileref)); | 835 | openFile(fileref); |
836 | // bFromDocView = TRUE; | ||
837 | // openFile(DocLnk(fileref)); | ||
836 | // showEditTools(); | 838 | // showEditTools(); |
837 | } | 839 | } |
838 | 840 | ||
839 | void TextEdit::closeEvent( QCloseEvent *e ) | 841 | void TextEdit::closeEvent( QCloseEvent *e ) |
840 | { | 842 | { |
841 | if ( editorStack->visibleWidget() == fileSelector && !bFromDocView ) { | 843 | if ( editorStack->visibleWidget() == fileSelector && !bFromDocView ) { |
842 | e->ignore(); | 844 | e->ignore(); |
843 | repaint(); | 845 | repaint(); |
844 | // fileRevert(); | 846 | // fileRevert(); |
845 | 847 | ||
846 | } else { | 848 | } else { |
847 | bFromDocView = FALSE; | 849 | bFromDocView = FALSE; |
848 | e->accept(); | 850 | e->accept(); |
849 | } | 851 | } |
850 | } | 852 | } |
851 | 853 | ||
852 | void TextEdit::accept() | 854 | void TextEdit::accept() |
853 | { | 855 | { |
854 | save(); | 856 | save(); |
855 | close(); | 857 | close(); |
856 | // fileOpen(); //godamn thats obnoxious! lemme out!!! | 858 | // fileOpen(); //godamn thats obnoxious! lemme out!!! |
857 | } | 859 | } |
858 | 860 | ||
859 | void TextEdit::changeFont() { | 861 | void TextEdit::changeFont() { |
860 | FontDatabase fdb; | 862 | FontDatabase fdb; |
861 | QFont defaultFont=editor->font(); | 863 | QFont defaultFont=editor->font(); |
862 | QFontInfo fontInfo(defaultFont); | 864 | QFontInfo fontInfo(defaultFont); |
863 | Config cfg("TextEdit"); | 865 | Config cfg("TextEdit"); |
864 | cfg.setGroup("Font"); | 866 | cfg.setGroup("Font"); |
865 | QString family = cfg.readEntry("Family", fontInfo.family()); | 867 | QString family = cfg.readEntry("Family", fontInfo.family()); |
866 | QString style = cfg.readEntry("Style", fdb.styleString(defaultFont)); | 868 | QString style = cfg.readEntry("Style", fdb.styleString(defaultFont)); |
867 | int i_size = cfg.readNumEntry("Size", fontInfo.pointSize()/10); | 869 | int i_size = cfg.readNumEntry("Size", fontInfo.pointSize()/10); |
868 | QString charSet = cfg.readEntry("CharSet", QFont::encodingName( fontInfo.charSet()) ); | 870 | QString charSet = cfg.readEntry("CharSet", QFont::encodingName( fontInfo.charSet()) ); |
869 | 871 | ||
870 | defaultFont = fdb.font(family,style,i_size,charSet); | 872 | defaultFont = fdb.font(family,style,i_size,charSet); |
871 | 873 | ||
872 | FontDialog *fontDlg; | 874 | FontDialog *fontDlg; |
873 | fontDlg=new FontDialog(this,"FontDialog",TRUE); | 875 | fontDlg=new FontDialog(this,"FontDialog",TRUE); |
874 | 876 | ||
875 | fontDlg->exec(); | 877 | fontDlg->exec(); |
876 | 878 | ||
877 | QFont myFont=fontDlg->selectedFont; | 879 | QFont myFont=fontDlg->selectedFont; |
878 | editor->setFont( myFont); | 880 | editor->setFont( myFont); |
879 | delete fontDlg; | 881 | delete fontDlg; |
880 | 882 | ||
881 | } | 883 | } |
882 | 884 | ||
883 | void TextEdit::editDelete() | 885 | void TextEdit::editDelete() |
884 | { | 886 | { |
885 | switch ( QMessageBox::warning(this,"Text Editor","Do you really want\nto delete the current file\nfrom the disk?\nThis is irreversable!!","Yes","No",0,0,1) ) { | 887 | switch ( QMessageBox::warning(this,"Text Editor","Do you really want\nto delete the current file\nfrom the disk?\nThis is irreversable!!","Yes","No",0,0,1) ) { |
886 | case 0: | 888 | case 0: |
887 | if(doc) { | 889 | if(doc) { |
888 | doc->removeFiles(); | 890 | doc->removeFiles(); |
889 | clear(); | 891 | clear(); |
890 | } | 892 | } |
891 | break; | 893 | break; |
892 | case 1: | 894 | case 1: |
893 | // exit | 895 | // exit |
894 | break; | 896 | break; |
895 | }; | 897 | }; |
896 | } | 898 | } |