-rw-r--r-- | libopie/libopie.pro | 4 | ||||
-rw-r--r-- | libopie/ofiledialog.cc | 14 | ||||
-rw-r--r-- | libopie/ofileselector.cc | 40 |
3 files changed, 20 insertions, 38 deletions
diff --git a/libopie/libopie.pro b/libopie/libopie.pro index 4ba2836..3c8da78 100644 --- a/libopie/libopie.pro +++ b/libopie/libopie.pro | |||
@@ -1,8 +1,8 @@ | |||
1 | TEMPLATE = lib | 1 | TEMPLATE = lib |
2 | CONFIG += qte warn_on release | 2 | CONFIG += qte warn_on release |
3 | HEADERS = ofileselector.h tododb.h todoevent.h todoresource.h todovcalresource.h xmltree.h oconfig.h | 3 | HEADERS = ofileselector.h ofiledialog.h tododb.h todoevent.h todoresource.h todovcalresource.h xmltree.h oconfig.h |
4 | SOURCES = ofileselector.cc xmltree.cc tododb.cpp todoevent.cpp todovcalresource.cpp oconfig.cpp | 4 | SOURCES = ofileselector.cc ofiledialog.cc xmltree.cc tododb.cpp todoevent.cpp todovcalresource.cpp oconfig.cpp |
5 | TARGET = opie | 5 | TARGET = opie |
6 | INCLUDEPATH += $(OPIEDIR)/include | 6 | INCLUDEPATH += $(OPIEDIR)/include |
7 | DESTDIR = $(QTDIR)/lib$(PROJMAK) | 7 | DESTDIR = $(QTDIR)/lib$(PROJMAK) |
8 | #VERSION = 1.0.0 \ No newline at end of file | 8 | #VERSION = 1.0.0 \ No newline at end of file |
diff --git a/libopie/ofiledialog.cc b/libopie/ofiledialog.cc index 92b0d0a..164fadd 100644 --- a/libopie/ofiledialog.cc +++ b/libopie/ofiledialog.cc | |||
@@ -11,100 +11,106 @@ | |||
11 | .%`+i> _;_. | 11 | .%`+i> _;_. |
12 | .i_,=:_. -<s. This library is distributed in the hope that | 12 | .i_,=:_. -<s. This library is distributed in the hope that |
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
14 | : .. .:, . . . without even the implied warranty of | 14 | : .. .:, . . . without even the implied warranty of |
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
17 | ..}^=.= = ; Library General Public License for more | 17 | ..}^=.= = ; Library General Public License for more |
18 | ++= -. .` .: details. | 18 | ++= -. .` .: details. |
19 | : = ...= . :.=- | 19 | : = ...= . :.=- |
20 | -. .:....=;==+<; You should have received a copy of the GNU | 20 | -. .:....=;==+<; You should have received a copy of the GNU |
21 | -_. . . )=. = Library General Public License along with | 21 | -_. . . )=. = Library General Public License along with |
22 | -- :-=` this library; see the file COPYING.LIB. | 22 | -- :-=` this library; see the file COPYING.LIB. |
23 | If not, write to the Free Software Foundation, | 23 | If not, write to the Free Software Foundation, |
24 | Inc., 59 Temple Place - Suite 330, | 24 | Inc., 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include <qpe/applnk.h> | 29 | #include <qpe/applnk.h> |
30 | #include <qstring.h> | 30 | #include <qstring.h> |
31 | #include <qapplication.h> | 31 | #include <qapplication.h> |
32 | #include <qlayout.h> | 32 | #include <qlayout.h> |
33 | 33 | ||
34 | #include "ofiledialog.h" | 34 | #include "ofiledialog.h" |
35 | 35 | ||
36 | OFileDialog::OFileDialog(const QString &caption, | 36 | OFileDialog::OFileDialog(const QString &caption, |
37 | QWidget *wid, int mode, int selector, | 37 | QWidget *wid, int mode, int selector, |
38 | const QString &dirName, | 38 | const QString &dirName, |
39 | const QString &fileName, | 39 | const QString &fileName, |
40 | const QStringList &mimetypes ) | 40 | const QStringList &mimetypes ) |
41 | : QDialog( wid, "OFileDialog", true ) | 41 | : QDialog( wid, "OFileDialog", true ) |
42 | { | 42 | { |
43 | QVBoxLayout *lay = new QVBoxLayout(this); | 43 | // QVBoxLayout *lay = new QVBoxLayout(this); |
44 | 44 | //showMaximized(); | |
45 | file = new OFileSelector(0 , mode, selector, | 45 | QVBoxLayout *lay = new QVBoxLayout(this ); |
46 | file = new OFileSelector(this , mode, selector, | ||
46 | dirName, fileName, | 47 | dirName, fileName, |
47 | mimetypes ); | 48 | mimetypes ); |
48 | lay->addWidget( file ); | 49 | lay->addWidget( file ); |
50 | |||
51 | //lay->addWidget( file ); | ||
49 | //showFullScreen(); | 52 | //showFullScreen(); |
50 | setCaption( caption.isEmpty() ? tr("FileDialog") : caption ); | 53 | setCaption( caption.isEmpty() ? tr("FileDialog") : caption ); |
51 | connect(file, SIGNAL(fileSelected(const QString&) ), | 54 | connect(file, SIGNAL(fileSelected(const QString&) ), |
52 | this, SLOT(slotFileSelected(const QString&) ) ); | 55 | this, SLOT(slotFileSelected(const QString&) ) ); |
53 | 56 | ||
54 | connect(file, SIGNAL(dirSelected(const QString &) ), | 57 | connect(file, SIGNAL(dirSelected(const QString &) ), |
55 | this, SLOT(slotDirSelected(const QString &) ) ); | 58 | this, SLOT(slotDirSelected(const QString &) ) ); |
56 | showMaximized(); | 59 | |
60 | |||
57 | file->setYesCancelVisible( false ); // relayout | 61 | file->setYesCancelVisible( false ); // relayout |
58 | } | 62 | } |
59 | QString OFileDialog::mimetype()const | 63 | QString OFileDialog::mimetype()const |
60 | { | 64 | { |
61 | return QString::null; | 65 | return QString::null; |
62 | } | 66 | } |
63 | QString OFileDialog::fileName()const | 67 | QString OFileDialog::fileName()const |
64 | { | 68 | { |
65 | return file->selectedName(); | 69 | return file->selectedName(); |
66 | } | 70 | } |
67 | DocLnk OFileDialog::selectedDocument()const | 71 | DocLnk OFileDialog::selectedDocument()const |
68 | { | 72 | { |
69 | return file->selectedDocument(); | 73 | return file->selectedDocument(); |
70 | } | 74 | } |
71 | QString OFileDialog::getOpenFileName(int selector, | 75 | QString OFileDialog::getOpenFileName(int selector, |
72 | const QString &startDir, | 76 | const QString &startDir, |
73 | const QString &file, | 77 | const QString &file, |
74 | const QStringList &mimes, | 78 | const QStringList &mimes, |
75 | QWidget *wid, | 79 | QWidget *wid, |
76 | const QString &caption ) | 80 | const QString &caption ) |
77 | { | 81 | { |
78 | QString ret; | 82 | QString ret; |
79 | OFileDialog dlg( caption.isEmpty() ? tr("Open") : caption, | 83 | OFileDialog dlg( caption.isEmpty() ? tr("Open") : caption, |
80 | wid, OFileSelector::OPEN, selector, startDir, file, mimes); | 84 | wid, OFileSelector::OPEN, selector, startDir, file, mimes); |
85 | dlg.showMaximized(); | ||
81 | if( dlg.exec() ) | 86 | if( dlg.exec() ) |
82 | ret = dlg.fileName(); | 87 | ret = dlg.fileName(); |
83 | 88 | ||
84 | return ret; | 89 | return ret; |
85 | } | 90 | } |
86 | QString OFileDialog::getSaveFileName(int selector, | 91 | QString OFileDialog::getSaveFileName(int selector, |
87 | const QString &startDir, | 92 | const QString &startDir, |
88 | const QString &file, | 93 | const QString &file, |
89 | const QStringList &mimes, | 94 | const QStringList &mimes, |
90 | QWidget *wid, | 95 | QWidget *wid, |
91 | const QString &caption ) | 96 | const QString &caption ) |
92 | { | 97 | { |
93 | QString ret; | 98 | QString ret; |
94 | OFileDialog dlg( caption.isEmpty() ? tr("Save") : caption, | 99 | OFileDialog dlg( caption.isEmpty() ? tr("Save") : caption, |
95 | wid, OFileSelector::SAVE, selector, startDir, file, mimes); | 100 | wid, OFileSelector::SAVE, selector, startDir, file, mimes); |
101 | dlg.showMaximized(); | ||
96 | if( dlg.exec() ) | 102 | if( dlg.exec() ) |
97 | ret = dlg.fileName(); | 103 | ret = dlg.fileName(); |
98 | 104 | ||
99 | return ret; | 105 | return ret; |
100 | } | 106 | } |
101 | 107 | ||
102 | void OFileDialog::slotFileSelected(const QString & ) | 108 | void OFileDialog::slotFileSelected(const QString & ) |
103 | { | 109 | { |
104 | accept(); | 110 | accept(); |
105 | } | 111 | } |
106 | void OFileDialog::slotDirSelected(const QString & ) | 112 | void OFileDialog::slotDirSelected(const QString & ) |
107 | { | 113 | { |
108 | // if mode | 114 | // if mode |
109 | //accept(); | 115 | //accept(); |
110 | } | 116 | } |
diff --git a/libopie/ofileselector.cc b/libopie/ofileselector.cc index c3a3514..7451c1b 100644 --- a/libopie/ofileselector.cc +++ b/libopie/ofileselector.cc | |||
@@ -50,66 +50,66 @@ | |||
50 | #include <qpe/mimetype.h> | 50 | #include <qpe/mimetype.h> |
51 | #include <qpe/resource.h> | 51 | #include <qpe/resource.h> |
52 | #include <qpe/storage.h> | 52 | #include <qpe/storage.h> |
53 | 53 | ||
54 | #include <unistd.h> | 54 | #include <unistd.h> |
55 | #include <stdlib.h> | 55 | #include <stdlib.h> |
56 | #include <sys/stat.h> | 56 | #include <sys/stat.h> |
57 | 57 | ||
58 | #include "ofileselector.h" | 58 | #include "ofileselector.h" |
59 | 59 | ||
60 | QMap<QString,QPixmap> *OFileSelector::m_pixmaps = 0; | 60 | QMap<QString,QPixmap> *OFileSelector::m_pixmaps = 0; |
61 | 61 | ||
62 | namespace { | 62 | namespace { |
63 | 63 | ||
64 | int indexByString( const QComboBox *box, const QString &str ){ | 64 | int indexByString( const QComboBox *box, const QString &str ){ |
65 | int index= -1; | 65 | int index= -1; |
66 | for(int i= 0; i < box->count(); i++ ){ | 66 | for(int i= 0; i < box->count(); i++ ){ |
67 | qWarning("str T%sT boxT%sT", str.latin1(), box->text(i).latin1() ); | 67 | qWarning("str T%sT boxT%sT", str.latin1(), box->text(i).latin1() ); |
68 | if( str == box->text(i ) ){ | 68 | if( str == box->text(i ) ){ |
69 | index= i; | 69 | index= i; |
70 | break; | 70 | break; |
71 | } | 71 | } |
72 | } | 72 | } |
73 | return index; | 73 | return index; |
74 | } | 74 | } |
75 | 75 | ||
76 | }; | 76 | }; |
77 | 77 | ||
78 | 78 | ||
79 | OFileSelector::OFileSelector(QWidget *wid, int mode, int selector, const QString &dirName, | 79 | OFileSelector::OFileSelector(QWidget *wid, int mode, int selector, const QString &dirName, |
80 | const QString &fileName, const QStringList &mimetypes ) : QWidget( wid ) | 80 | const QString &fileName, const QStringList &mimetypes ) : QWidget( wid ) |
81 | { | 81 | { |
82 | 82 | if(wid!=0) | |
83 | resize(wid->width(),wid->height()); | 83 | resize(wid->width(),wid->height()); |
84 | m_selector = selector; | 84 | m_selector = selector; |
85 | m_currentDir = dirName; | 85 | m_currentDir = dirName; |
86 | m_name = fileName; | 86 | m_name = fileName; |
87 | m_mimetypes = mimetypes; | 87 | m_mimetypes = mimetypes; |
88 | if( mimetypes.isEmpty() ) | 88 | if( mimetypes.isEmpty() ) |
89 | m_autoMime = true; | 89 | m_autoMime = true; |
90 | 90 | ||
91 | m_mode = mode; | 91 | m_mode = mode; |
92 | m_shTool = true; | 92 | m_shTool = true; |
93 | m_shPerm = true; | 93 | m_shPerm = true; |
94 | m_shLne = true; | 94 | m_shLne = true; |
95 | m_shChooser = true; | 95 | m_shChooser = true; |
96 | m_shYesNo = true; | 96 | m_shYesNo = true; |
97 | // for FILESELECTOR only view is interesting | 97 | // for FILESELECTOR only view is interesting |
98 | m_location = 0; | 98 | m_location = 0; |
99 | m_homeButton = 0; | 99 | m_homeButton = 0; |
100 | m_docButton = 0; | 100 | m_docButton = 0; |
101 | m_hideButton = 0; | 101 | m_hideButton = 0; |
102 | m_ok = 0; | 102 | m_ok = 0; |
103 | m_cancel = 0; | 103 | m_cancel = 0; |
104 | m_reread = 0; | 104 | m_reread = 0; |
105 | m_up = 0; | 105 | m_up = 0; |
106 | m_View = 0; | 106 | m_View = 0; |
107 | m_select = 0; | 107 | m_select = 0; |
108 | m_stack = 0; | 108 | m_stack = 0; |
109 | 109 | ||
110 | m_select = 0; | 110 | m_select = 0; |
111 | m_stack = 0; | 111 | m_stack = 0; |
112 | m_lay = 0; | 112 | m_lay = 0; |
113 | m_boxToolbar = 0; | 113 | m_boxToolbar = 0; |
114 | m_boxOk = 0; | 114 | m_boxOk = 0; |
115 | m_edit = 0; | 115 | m_edit = 0; |
@@ -165,64 +165,65 @@ void OFileSelector::initPics() | |||
165 | ____________________ | 165 | ____________________ |
166 | | LineEdit | | 166 | | LineEdit | |
167 | ____________________ | 167 | ____________________ |
168 | | Permission Bar | | 168 | | Permission Bar | |
169 | ____________________ | 169 | ____________________ |
170 | | ViewChoose | | 170 | | ViewChoose | |
171 | ____________________ | 171 | ____________________ |
172 | | Save Cancel| | 172 | | Save Cancel| |
173 | ____________________ | 173 | ____________________ |
174 | */ | 174 | */ |
175 | void OFileSelector::delItems() | 175 | void OFileSelector::delItems() |
176 | { | 176 | { |
177 | QLayoutIterator it = m_lay->iterator(); | 177 | QLayoutIterator it = m_lay->iterator(); |
178 | while ( it.current() != 0 ){ | 178 | while ( it.current() != 0 ){ |
179 | it.deleteCurrent(); | 179 | it.deleteCurrent(); |
180 | } | 180 | } |
181 | } | 181 | } |
182 | void OFileSelector::init() | 182 | void OFileSelector::init() |
183 | { | 183 | { |
184 | 184 | ||
185 | m_stack = new QWidgetStack(this, "wstack" ); | 185 | m_stack = new QWidgetStack(this, "wstack" ); |
186 | if( m_selector == NORMAL ){ | 186 | if( m_selector == NORMAL ){ |
187 | QString currMime; | 187 | QString currMime; |
188 | if( m_mimeCheck != 0 ) | 188 | if( m_mimeCheck != 0 ) |
189 | currMime = m_mimeCheck->currentText(); | 189 | currMime = m_mimeCheck->currentText(); |
190 | 190 | ||
191 | updateMimes(); | 191 | updateMimes(); |
192 | m_select = new FileSelector( currMime == "All" ? QString::null : currMime , m_stack, "fileselector", FALSE, FALSE ); | 192 | m_select = new FileSelector( currMime == "All" ? QString::null : currMime , m_stack, "fileselector", FALSE, FALSE ); |
193 | m_stack->addWidget(m_select, NORMAL ); | 193 | m_stack->addWidget(m_select, NORMAL ); |
194 | m_lay->addWidget(m_stack ); | 194 | m_lay->addWidget(m_stack ); |
195 | m_stack->raiseWidget(NORMAL ); | 195 | m_stack->raiseWidget(NORMAL ); |
196 | connect(m_select, SIGNAL(fileSelected( const DocLnk &) ), this, SLOT(slotFileBridgeSelected(const DocLnk &) ) ); | 196 | connect(m_select, SIGNAL(fileSelected( const DocLnk &) ), this, SLOT(slotFileBridgeSelected(const DocLnk &) ) ); |
197 | m_pseudoLayout = 0l; | ||
197 | }else { | 198 | }else { |
198 | initializeListView(); | 199 | initializeListView(); |
199 | } | 200 | } |
200 | 201 | ||
201 | if(m_shLne ){ | 202 | if(m_shLne ){ |
202 | initializeName(); | 203 | initializeName(); |
203 | } | 204 | } |
204 | 205 | ||
205 | if(m_shPerm ){ | 206 | if(m_shPerm ){ |
206 | m_checkPerm = new QCheckBox(tr("Set Permission"), this, "Permission" ); | 207 | m_checkPerm = new QCheckBox(tr("Set Permission"), this, "Permission" ); |
207 | m_checkPerm->setChecked( false ); | 208 | m_checkPerm->setChecked( false ); |
208 | m_lay->addWidget(m_checkPerm ); | 209 | m_lay->addWidget(m_checkPerm ); |
209 | } | 210 | } |
210 | 211 | ||
211 | if( m_shChooser ) | 212 | if( m_shChooser ) |
212 | initializeChooser(); | 213 | initializeChooser(); |
213 | 214 | ||
214 | if(m_shYesNo ) | 215 | if(m_shYesNo ) |
215 | initializeYes(); | 216 | initializeYes(); |
216 | 217 | ||
217 | 218 | ||
218 | }; | 219 | }; |
219 | 220 | ||
220 | void OFileSelector::setYesCancelVisible( bool show ) | 221 | void OFileSelector::setYesCancelVisible( bool show ) |
221 | { | 222 | { |
222 | if ( show == m_shYesNo ) | 223 | if ( show == m_shYesNo ) |
223 | return; | 224 | return; |
224 | m_shYesNo = show; | 225 | m_shYesNo = show; |
225 | if( !show ){ | 226 | if( !show ){ |
226 | delete m_ok; | 227 | delete m_ok; |
227 | delete m_cancel; | 228 | delete m_cancel; |
228 | m_ok = 0; | 229 | m_ok = 0; |
@@ -566,171 +567,146 @@ void OFileSelector::initializeChooser() | |||
566 | this, SLOT(slotViewCheck(const QString & ) ) ); | 567 | this, SLOT(slotViewCheck(const QString & ) ) ); |
567 | 568 | ||
568 | connect( m_mimeCheck, SIGNAL(activated(const QString &) ), | 569 | connect( m_mimeCheck, SIGNAL(activated(const QString &) ), |
569 | this, SLOT(slotMimeCheck(const QString & ) ) ); | 570 | this, SLOT(slotMimeCheck(const QString & ) ) ); |
570 | } | 571 | } |
571 | void OFileSelector::slotMimeCheck(const QString &view ){ | 572 | void OFileSelector::slotMimeCheck(const QString &view ){ |
572 | if(m_selector == NORMAL ){ | 573 | if(m_selector == NORMAL ){ |
573 | delete m_select; | 574 | delete m_select; |
574 | m_select = new FileSelector(view == "All" ? QString::null : view | 575 | m_select = new FileSelector(view == "All" ? QString::null : view |
575 | , m_stack, "fileselector", FALSE, FALSE ); | 576 | , m_stack, "fileselector", FALSE, FALSE ); |
576 | m_stack->addWidget( m_select, NORMAL ); | 577 | m_stack->addWidget( m_select, NORMAL ); |
577 | m_stack->raiseWidget( NORMAL ); | 578 | m_stack->raiseWidget( NORMAL ); |
578 | }else{ | 579 | }else{ |
579 | reparse(); | 580 | reparse(); |
580 | } | 581 | } |
581 | } | 582 | } |
582 | 583 | ||
583 | void OFileSelector::slotViewCheck(const QString &view ){ | 584 | void OFileSelector::slotViewCheck(const QString &view ){ |
584 | qWarning("changed: show %s", view.latin1() ); | 585 | qWarning("changed: show %s", view.latin1() ); |
585 | // if the current view is the one | 586 | // if the current view is the one |
586 | QString currMime = m_mimeCheck->currentText(); | 587 | QString currMime = m_mimeCheck->currentText(); |
587 | if( view == QString::fromLatin1("Documents") ){ | 588 | if( view == QString::fromLatin1("Documents") ){ |
588 | // get the mimetype now | 589 | // get the mimetype now |
589 | // check if we're the current widget and return | 590 | // check if we're the current widget and return |
590 | if( m_View != 0) { // delete 0 shouldn't crash but it did :( | 591 | if( m_View != 0) { // delete 0 shouldn't crash but it did :( |
591 | delete m_View; | 592 | delete m_View; |
592 | delete m_boxToolbar; | 593 | delete m_boxToolbar; |
593 | delete m_homeButton; | 594 | delete m_homeButton; |
594 | delete m_docButton; | 595 | delete m_docButton; |
595 | delete m_location; | 596 | delete m_location; |
596 | delete m_up; | 597 | delete m_up; |
597 | delete m_pseudo; | 598 | delete m_pseudo; |
598 | delete m_pseudoLayout; | 599 | if(m_pseudoLayout!=0 ) |
600 | delete m_pseudoLayout; | ||
599 | } | 601 | } |
600 | m_View = 0; | 602 | m_View = 0; |
601 | m_boxToolbar = 0; | 603 | m_boxToolbar = 0; |
602 | m_homeButton = 0; | 604 | m_homeButton = 0; |
603 | m_docButton = 0; | 605 | m_docButton = 0; |
604 | m_location = 0; | 606 | m_location = 0; |
605 | m_up = 0; | 607 | m_up = 0; |
606 | m_pseudo = 0; | 608 | m_pseudo = 0; |
607 | m_pseudoLayout = 0; | 609 | m_pseudoLayout = 0; |
608 | 610 | ||
609 | delete m_select; | 611 | delete m_select; |
610 | m_select = new FileSelector( currMime == "All" ? QString::null : currMime, | 612 | m_select = new FileSelector( currMime == "All" ? QString::null : currMime, |
611 | m_stack,"fileselector", FALSE, FALSE ); | 613 | m_stack,"fileselector", FALSE, FALSE ); |
612 | m_stack->addWidget( m_select, NORMAL ); | 614 | m_stack->addWidget( m_select, NORMAL ); |
613 | m_mimeCheck->clear(); | 615 | m_mimeCheck->clear(); |
614 | m_selector = NORMAL; | 616 | m_selector = NORMAL; |
615 | updateMimes(); | 617 | updateMimes(); |
616 | m_mimeCheck->insertStringList( m_mimetypes ); | 618 | m_mimeCheck->insertStringList( m_mimetypes ); |
617 | m_stack->raiseWidget( NORMAL ); | 619 | m_stack->raiseWidget( NORMAL ); |
618 | connect(m_select, SIGNAL(fileSelected( const DocLnk &) ), this, SLOT(slotFileBridgeSelected(const DocLnk &) ) ); | 620 | connect(m_select, SIGNAL(fileSelected( const DocLnk &) ), this, SLOT(slotFileBridgeSelected(const DocLnk &) ) ); |
619 | 621 | ||
620 | }else if(view == QString::fromLatin1("Files") ){ | 622 | }else if(view == QString::fromLatin1("Files") ){ |
621 | // remove from the stack | 623 | // remove from the stack |
622 | delete m_select; | 624 | delete m_select; |
623 | m_select = 0; | 625 | m_select = 0; |
624 | delete m_View; | 626 | delete m_View; |
625 | m_View = 0; | 627 | m_View = 0; |
626 | 628 | ||
627 | delete m_boxToolbar; | 629 | |
628 | delete m_homeButton; | ||
629 | delete m_docButton; | ||
630 | delete m_location; | ||
631 | delete m_up; | ||
632 | delete m_pseudo; | ||
633 | delete m_pseudoLayout; | ||
634 | m_boxToolbar = 0; | ||
635 | m_homeButton = 0; | ||
636 | m_docButton = 0; | ||
637 | m_location = 0; | ||
638 | m_up = 0; | ||
639 | m_pseudo = 0; | ||
640 | m_pseudoLayout = 0; | ||
641 | 630 | ||
642 | m_selector = EXTENDED; | 631 | m_selector = EXTENDED; |
643 | // create the ListView or IconView | 632 | // create the ListView or IconView |
644 | initializeListView(); | 633 | initializeListView(); |
645 | 634 | ||
646 | reparse(); | 635 | reparse(); |
647 | }else if(view == QString::fromLatin1("All Files") ) { | 636 | }else if(view == QString::fromLatin1("All Files") ) { |
648 | // remove from the stack | 637 | // remove from the stack |
649 | delete m_select; | 638 | delete m_select; |
650 | m_select = 0; | 639 | m_select = 0; |
651 | delete m_View; | 640 | delete m_View; |
652 | m_View = 0; | 641 | m_View = 0; |
653 | delete m_boxToolbar; | ||
654 | delete m_homeButton; | ||
655 | delete m_docButton; | ||
656 | delete m_location; | ||
657 | delete m_up; | ||
658 | delete m_pseudo; | ||
659 | delete m_pseudoLayout; | ||
660 | m_boxToolbar = 0; | ||
661 | m_homeButton = 0; | ||
662 | m_docButton = 0; | ||
663 | m_location = 0; | ||
664 | m_up = 0; | ||
665 | m_pseudo = 0; | ||
666 | m_pseudoLayout = 0; | ||
667 | 642 | ||
668 | m_selector = EXTENDED_ALL; | 643 | m_selector = EXTENDED_ALL; |
669 | initializeListView(); | 644 | initializeListView(); |
670 | reparse(); | 645 | reparse(); |
671 | }; | 646 | }; |
672 | }; | 647 | }; |
673 | 648 | ||
674 | 649 | ||
675 | void OFileSelector::updateMimes() // lets check which mode is active | 650 | void OFileSelector::updateMimes() // lets check which mode is active |
676 | // check the current dir for items then | 651 | // check the current dir for items then |
677 | { | 652 | { |
678 | m_mimetypes.clear(); | 653 | m_mimetypes.clear(); |
679 | m_mimetypes.append("All" ); | 654 | m_mimetypes.append("All" ); |
680 | if( m_selector == NORMAL ){ | 655 | if( m_selector == NORMAL ){ |
681 | DocLnkSet set; | 656 | DocLnkSet set; |
682 | Global::findDocuments(&set, QString::null ); | 657 | Global::findDocuments(&set, QString::null ); |
683 | QListIterator<DocLnk> dit( set.children() ); | 658 | QListIterator<DocLnk> dit( set.children() ); |
684 | for ( ; dit.current(); ++dit ) { | 659 | for ( ; dit.current(); ++dit ) { |
685 | if( !m_mimetypes.contains((*dit)->type() ) ) | 660 | if( !m_mimetypes.contains((*dit)->type() ) ) |
686 | m_mimetypes.append( (*dit)->type() ); | 661 | m_mimetypes.append( (*dit)->type() ); |
687 | } | 662 | } |
688 | }else{ | 663 | }else{ |
689 | // should be allreday updatet | 664 | // should be allreday updatet |
690 | ; | 665 | ; |
691 | } | 666 | } |
692 | }; | 667 | }; |
693 | void OFileSelector::initializeListView() | 668 | void OFileSelector::initializeListView() |
694 | { | 669 | { |
695 | // just to make sure but clean it up better FIXME | 670 | // just to make sure but clean it up better FIXME |
696 | delete m_View; | 671 | delete m_View; |
697 | m_View = 0; | 672 | m_View = 0; |
698 | delete m_boxToolbar; | 673 | delete m_boxToolbar; |
699 | delete m_homeButton; | 674 | delete m_homeButton; |
700 | delete m_docButton; | 675 | delete m_docButton; |
701 | delete m_location; | 676 | delete m_location; |
702 | delete m_up; | 677 | delete m_up; |
703 | delete m_pseudo; | 678 | delete m_pseudo; |
704 | delete m_pseudoLayout; | 679 | if(m_pseudoLayout!=0 ) // why did you overload malloc |
680 | delete m_pseudoLayout; | ||
705 | m_boxToolbar = 0; | 681 | m_boxToolbar = 0; |
706 | m_homeButton = 0; | 682 | m_homeButton = 0; |
707 | m_docButton = 0; | 683 | m_docButton = 0; |
708 | m_location = 0; | 684 | m_location = 0; |
709 | m_up = 0; | 685 | m_up = 0; |
710 | m_pseudo = 0; | 686 | m_pseudo = 0; |
711 | m_pseudoLayout = 0; | 687 | m_pseudoLayout = 0; |
712 | // time for the toolbar | 688 | // time for the toolbar |
713 | m_pseudo = new QWidget(m_stack, "Pseudo Widget"); | 689 | m_pseudo = new QWidget(m_stack, "Pseudo Widget"); |
714 | m_pseudoLayout = new QVBoxLayout(m_pseudo ); | 690 | m_pseudoLayout = new QVBoxLayout(m_pseudo ); |
715 | if(m_shTool ){ | 691 | if(m_shTool ){ |
716 | m_boxToolbar = new QHBoxLayout( ); | 692 | m_boxToolbar = new QHBoxLayout( ); |
717 | m_boxToolbar->setAutoAdd( true ); | 693 | m_boxToolbar->setAutoAdd( true ); |
718 | m_location = new QComboBox(m_pseudo ); | 694 | m_location = new QComboBox(m_pseudo ); |
719 | 695 | ||
720 | m_up = new QPushButton(Resource::loadIconSet("up"),"", m_pseudo,"cdUpButton"); | 696 | m_up = new QPushButton(Resource::loadIconSet("up"),"", m_pseudo,"cdUpButton"); |
721 | m_up->setMinimumSize( QSize( 20, 20 ) ); | 697 | m_up->setMinimumSize( QSize( 20, 20 ) ); |
722 | m_up->setMaximumSize( QSize( 20, 20 ) ); | 698 | m_up->setMaximumSize( QSize( 20, 20 ) ); |
723 | connect(m_up ,SIGNAL(clicked()),this,SLOT(cdUP() ) ); | 699 | connect(m_up ,SIGNAL(clicked()),this,SLOT(cdUP() ) ); |
724 | m_up->setFlat(TRUE); | 700 | m_up->setFlat(TRUE); |
725 | 701 | ||
726 | m_homeButton = new QPushButton(Resource::loadIconSet("home") , "", m_pseudo); | 702 | m_homeButton = new QPushButton(Resource::loadIconSet("home") , "", m_pseudo); |
727 | m_homeButton->setMinimumSize( QSize( 20, 20 ) ); | 703 | m_homeButton->setMinimumSize( QSize( 20, 20 ) ); |
728 | m_homeButton->setMaximumSize( QSize( 20, 20 ) ); | 704 | m_homeButton->setMaximumSize( QSize( 20, 20 ) ); |
729 | connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotHome() ) ); | 705 | connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotHome() ) ); |
730 | m_homeButton->setFlat(TRUE); | 706 | m_homeButton->setFlat(TRUE); |
731 | 707 | ||
732 | m_docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"", m_pseudo,"docsButton"); | 708 | m_docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"", m_pseudo,"docsButton"); |
733 | m_docButton->setMinimumSize( QSize( 20, 20 ) ); | 709 | m_docButton->setMinimumSize( QSize( 20, 20 ) ); |
734 | m_docButton->setMaximumSize( QSize( 20, 20 ) ); | 710 | m_docButton->setMaximumSize( QSize( 20, 20 ) ); |
735 | connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotDoc() ) ); | 711 | connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotDoc() ) ); |
736 | m_docButton->setFlat(TRUE); | 712 | m_docButton->setFlat(TRUE); |