-rw-r--r-- | bin/kdepim/WhatsNew.txt | 3 | ||||
-rw-r--r-- | microkde/ofileselector_p.cpp | 34 |
2 files changed, 30 insertions, 7 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt index eaf4b56..dd02be5 100644 --- a/bin/kdepim/WhatsNew.txt +++ b/bin/kdepim/WhatsNew.txt | |||
@@ -1,134 +1,137 @@ | |||
1 | Info about the changes in new versions of KDE-Pim/Pi | 1 | Info about the changes in new versions of KDE-Pim/Pi |
2 | 2 | ||
3 | 3 | ||
4 | ********** VERSION 2.1.8 ************ | 4 | ********** VERSION 2.1.8 ************ |
5 | 5 | ||
6 | KO/Pi: | 6 | KO/Pi: |
7 | Added info about the completion sate of a todo in the ListView/Searchdialog. | 7 | Added info about the completion sate of a todo in the ListView/Searchdialog. |
8 | If in TodoView is selected "do not show compledted todos" then completed todos are not shown in the ListView as well. | 8 | If in TodoView is selected "do not show compledted todos" then completed todos are not shown in the ListView as well. |
9 | 9 | ||
10 | KA/Pi: | 10 | KA/Pi: |
11 | In the addressee selection dialog now the formatted name is shown, if not empty. | 11 | In the addressee selection dialog now the formatted name is shown, if not empty. |
12 | 12 | ||
13 | Fixed in the file selector on the Zaurus the problem that symbolic links to files/dirs were ignored. | ||
14 | Fixed the sorting for size in the file selector on the Z. | ||
15 | |||
13 | ********** VERSION 2.1.7 ************ | 16 | ********** VERSION 2.1.7 ************ |
14 | 17 | ||
15 | KO/Pi: | 18 | KO/Pi: |
16 | Fixed several problems in the new Resource handling. | 19 | Fixed several problems in the new Resource handling. |
17 | Added more options to the search dialog. | 20 | Added more options to the search dialog. |
18 | Fixed a problem in the Month view. | 21 | Fixed a problem in the Month view. |
19 | Added more options to the dialog when setting a todo to stopped. | 22 | Added more options to the dialog when setting a todo to stopped. |
20 | 23 | ||
21 | Fixed two small problems in KO/PiAlarm applet. | 24 | Fixed two small problems in KO/PiAlarm applet. |
22 | 25 | ||
23 | ********** VERSION 2.1.6 ************ | 26 | ********** VERSION 2.1.6 ************ |
24 | 27 | ||
25 | This release is for testing only. | 28 | This release is for testing only. |
26 | 29 | ||
27 | KO/Pi: | 30 | KO/Pi: |
28 | Added to the list view (the list view is used in search dialog as well) the possibility to print it. | 31 | Added to the list view (the list view is used in search dialog as well) the possibility to print it. |
29 | Added to the list view the possibility to hide entries, if you do not want to print all entries of the list view. | 32 | Added to the list view the possibility to hide entries, if you do not want to print all entries of the list view. |
30 | Added to the list view the possibility to add all subtodos of selected todos to an export/beam. | 33 | Added to the list view the possibility to add all subtodos of selected todos to an export/beam. |
31 | Added to the search dialog the possibility to make an additive search such that you can get a better list for export/printout. | 34 | Added to the search dialog the possibility to make an additive search such that you can get a better list for export/printout. |
32 | Added to the search dialog the possibility to hide the checkboxes such that there is more space for the list view on the Zaurus. | 35 | Added to the search dialog the possibility to hide the checkboxes such that there is more space for the list view on the Zaurus. |
33 | Fixed a problem in the AlarmTimer Applet: Now utf8 messages are displayed properly. | 36 | Fixed a problem in the AlarmTimer Applet: Now utf8 messages are displayed properly. |
34 | 37 | ||
35 | Added support for multiple calendar files in KO/Pi. Only local ical (*.ics) files are supported as calendars. | 38 | Added support for multiple calendar files in KO/Pi. Only local ical (*.ics) files are supported as calendars. |
36 | In the sync profile config it is still missing to specify a particular calendar to sync with this profile. That setting will be added later. | 39 | In the sync profile config it is still missing to specify a particular calendar to sync with this profile. That setting will be added later. |
37 | Now on every sync the set of calendars is synced which are enabled in the resource view. | 40 | Now on every sync the set of calendars is synced which are enabled in the resource view. |
38 | 41 | ||
39 | A calendar is enabled in the resource view if the "eye" column is checked. | 42 | A calendar is enabled in the resource view if the "eye" column is checked. |
40 | You can set a calendar to be the default for new items( "+" column ). | 43 | You can set a calendar to be the default for new items( "+" column ). |
41 | You can tell KO/Pi to ignore all alarm of a calendar ( "bell" column ) and you can set it readonly. | 44 | You can tell KO/Pi to ignore all alarm of a calendar ( "bell" column ) and you can set it readonly. |
42 | To find out how to add a new calendar and how to remove a calendar is left as an exercise to the reader ... | 45 | To find out how to add a new calendar and how to remove a calendar is left as an exercise to the reader ... |
43 | 46 | ||
44 | 47 | ||
45 | ********** VERSION 2.1.5 ************ | 48 | ********** VERSION 2.1.5 ************ |
46 | 49 | ||
47 | This is the new stable version. | 50 | This is the new stable version. |
48 | Bugfix: | 51 | Bugfix: |
49 | Fixed a problem with agenda popup on the desktop in KO/Pi. | 52 | Fixed a problem with agenda popup on the desktop in KO/Pi. |
50 | Fixed a crash when reloading file, e.g. after a passive pi-sync synchronization. | 53 | Fixed a crash when reloading file, e.g. after a passive pi-sync synchronization. |
51 | Added config option to not display completed todos in agenda view. | 54 | Added config option to not display completed todos in agenda view. |
52 | Addressee view is now using the formatted name, if defined. | 55 | Addressee view is now using the formatted name, if defined. |
53 | That makes it possible to display "lastname, firstname" in that view now. | 56 | That makes it possible to display "lastname, firstname" in that view now. |
54 | To set the formatted name for all contacts, please use menu: | 57 | To set the formatted name for all contacts, please use menu: |
55 | Edit->Change->Set formatted name. | 58 | Edit->Change->Set formatted name. |
56 | Fixed the bug in KA/Pi that is was not possible to add images to a contact on Windows. | 59 | Fixed the bug in KA/Pi that is was not possible to add images to a contact on Windows. |
57 | 60 | ||
58 | ********** VERSION 2.1.4 ************ | 61 | ********** VERSION 2.1.4 ************ |
59 | 62 | ||
60 | Fixed two more bugs in the KA/Pi CSV import dialog: | 63 | Fixed two more bugs in the KA/Pi CSV import dialog: |
61 | Made it possible to read multi-line fields and import it to the "Note" field. | 64 | Made it possible to read multi-line fields and import it to the "Note" field. |
62 | Fixed a problem in mapping custom fields, whatever a custem field is... | 65 | Fixed a problem in mapping custom fields, whatever a custem field is... |
63 | 66 | ||
64 | ********** VERSION 2.1.3 ************ | 67 | ********** VERSION 2.1.3 ************ |
65 | 68 | ||
66 | Changed the menu structure of the alarm applet: | 69 | Changed the menu structure of the alarm applet: |
67 | Moved "Simulate" to " Play Beeps" submenu and re-added "Todo List". | 70 | Moved "Simulate" to " Play Beeps" submenu and re-added "Todo List". |
68 | 71 | ||
69 | Fixed several problems in the KA/Pi CSV import dialog: | 72 | Fixed several problems in the KA/Pi CSV import dialog: |
70 | Added "Category", made codec configureable and made it possible to map many fields to the "Note" field. | 73 | Added "Category", made codec configureable and made it possible to map many fields to the "Note" field. |
71 | 74 | ||
72 | 75 | ||
73 | ********** VERSION 2.1.2 ************ | 76 | ********** VERSION 2.1.2 ************ |
74 | 77 | ||
75 | Fixed a problem closing the alarm dialog on Zaurus with "OK" button. | 78 | Fixed a problem closing the alarm dialog on Zaurus with "OK" button. |
76 | 79 | ||
77 | Fixed a problem when importing data from Outlook with mutiple categories set. | 80 | Fixed a problem when importing data from Outlook with mutiple categories set. |
78 | 81 | ||
79 | Changed display of days in datenavigator: | 82 | Changed display of days in datenavigator: |
80 | Birthdays are now blue, not dark green. | 83 | Birthdays are now blue, not dark green. |
81 | When todo view is shown, no birtdays are shown and days with due todos are shown blue. | 84 | When todo view is shown, no birtdays are shown and days with due todos are shown blue. |
82 | When journal view is shown, only holidays are shown and days with journals are blue. | 85 | When journal view is shown, only holidays are shown and days with journals are blue. |
83 | 86 | ||
84 | Added Backup options to global config: | 87 | Added Backup options to global config: |
85 | You can create now x-daily backups for KO/Pi, KA/Pi (for file resources only, file resource is the standard type) and PwM/Pi ( all files you will open ). | 88 | You can create now x-daily backups for KO/Pi, KA/Pi (for file resources only, file resource is the standard type) and PwM/Pi ( all files you will open ). |
86 | It is recommended to use another HDD/Memory card for the backup directory. If (very useful on the Zaurus) the specified backup directory does not exist you are asked if you want to try again to create a backup. That makes it possible to insert your memory card in the Zaurus and then trying again. | 89 | It is recommended to use another HDD/Memory card for the backup directory. If (very useful on the Zaurus) the specified backup directory does not exist you are asked if you want to try again to create a backup. That makes it possible to insert your memory card in the Zaurus and then trying again. |
87 | The backup is created when the application wants to save for the first time on a backup-day. You can specify the amount of backups and the day interval of backups. | 90 | The backup is created when the application wants to save for the first time on a backup-day. You can specify the amount of backups and the day interval of backups. |
88 | 91 | ||
89 | ********** VERSION 2.1.1 ************ | 92 | ********** VERSION 2.1.1 ************ |
90 | 93 | ||
91 | Stable release 2.1.1! | 94 | Stable release 2.1.1! |
92 | 95 | ||
93 | KO/Pi: | 96 | KO/Pi: |
94 | Fixed one problem in the layout of the edit dialogs on the Zaurus with 640x480 display. | 97 | Fixed one problem in the layout of the edit dialogs on the Zaurus with 640x480 display. |
95 | 98 | ||
96 | ********** VERSION 2.1.0 ************ | 99 | ********** VERSION 2.1.0 ************ |
97 | 100 | ||
98 | Stable release 2.1.0! | 101 | Stable release 2.1.0! |
99 | 102 | ||
100 | Summary of changes/fixes compared to version 2.0.6: | 103 | Summary of changes/fixes compared to version 2.0.6: |
101 | 104 | ||
102 | Many bugs of version 2.0.6 fixed. | 105 | Many bugs of version 2.0.6 fixed. |
103 | Most of them were small bugs, but some of them were important. | 106 | Most of them were small bugs, but some of them were important. |
104 | It is recommended to use version 2.1.0 and not version 2.0.6. | 107 | It is recommended to use version 2.1.0 and not version 2.0.6. |
105 | 108 | ||
106 | Important changes: | 109 | Important changes: |
107 | 110 | ||
108 | Added recurring todos to KO/Pi. | 111 | Added recurring todos to KO/Pi. |
109 | 112 | ||
110 | Added global application font settings (for all KDE-Pim/Pi apps) to the general settings. | 113 | Added global application font settings (for all KDE-Pim/Pi apps) to the general settings. |
111 | 114 | ||
112 | Made Passwordmanager PwM/Pi more userfriendly: Rearranged some toolbar icons, optimized setting of focus, fixed layout problems and more. | 115 | Made Passwordmanager PwM/Pi more userfriendly: Rearranged some toolbar icons, optimized setting of focus, fixed layout problems and more. |
113 | 116 | ||
114 | Datenavigator can now display many months. Very useful on the desktop. | 117 | Datenavigator can now display many months. Very useful on the desktop. |
115 | 118 | ||
116 | KO/Pi alarm applet changed: Made buttons in alarm dialog much bigger and other usebility enhancements. | 119 | KO/Pi alarm applet changed: Made buttons in alarm dialog much bigger and other usebility enhancements. |
117 | 120 | ||
118 | Made alarm sound working on Linux desktop. | 121 | Made alarm sound working on Linux desktop. |
119 | 122 | ||
120 | Made KO/Pi and KA/Pi running from a memory stick. Please read storage HowTo for details. | 123 | Made KO/Pi and KA/Pi running from a memory stick. Please read storage HowTo for details. |
121 | 124 | ||
122 | Added timetracking feature in KO/Pi todo view. Please read timetraker HowTo for details. | 125 | Added timetracking feature in KO/Pi todo view. Please read timetraker HowTo for details. |
123 | 126 | ||
124 | Many other usebility enhancements. | 127 | Many other usebility enhancements. |
125 | Special thanks to Ben for his suggestions! | 128 | Special thanks to Ben for his suggestions! |
126 | 129 | ||
127 | You can find the complete changelog | 130 | You can find the complete changelog |
128 | from version 1.7.7 to 2.1.0 | 131 | from version 1.7.7 to 2.1.0 |
129 | in the source package or on | 132 | in the source package or on |
130 | 133 | ||
131 | http://www.pi-sync.net/html/changelog.html | 134 | http://www.pi-sync.net/html/changelog.html |
132 | 135 | ||
133 | 136 | ||
134 | 137 | ||
diff --git a/microkde/ofileselector_p.cpp b/microkde/ofileselector_p.cpp index f85f8f4..e2af32b 100644 --- a/microkde/ofileselector_p.cpp +++ b/microkde/ofileselector_p.cpp | |||
@@ -1,771 +1,791 @@ | |||
1 | #include <qcombobox.h> | 1 | #include <qcombobox.h> |
2 | #include <qdir.h> | 2 | #include <qdir.h> |
3 | #include <qhbox.h> | 3 | #include <qhbox.h> |
4 | #include <qheader.h> | 4 | #include <qheader.h> |
5 | #include <qlabel.h> | 5 | #include <qlabel.h> |
6 | #include <qlayout.h> | 6 | #include <qlayout.h> |
7 | #include <qlineedit.h> | 7 | #include <qlineedit.h> |
8 | #include <qlistview.h> | 8 | #include <qlistview.h> |
9 | #include <qpopupmenu.h> | 9 | #include <qpopupmenu.h> |
10 | #include <qwidgetstack.h> | 10 | #include <qwidgetstack.h> |
11 | #include <qregexp.h> | 11 | #include <qregexp.h> |
12 | #include <qobjectlist.h> | 12 | #include <qobjectlist.h> |
13 | 13 | ||
14 | /* hacky but we need to get FileSelector::filter */ | 14 | /* hacky but we need to get FileSelector::filter */ |
15 | #define private public | 15 | #define private public |
16 | #include <qpe/fileselector.h> | 16 | #include <qpe/fileselector.h> |
17 | #undef private | 17 | #undef private |
18 | 18 | ||
19 | #include <qpe/qpeapplication.h> | 19 | #include <qpe/qpeapplication.h> |
20 | #include <qpe/mimetype.h> | 20 | #include <qpe/mimetype.h> |
21 | #include <qpe/resource.h> | 21 | #include <qpe/resource.h> |
22 | #include <qpe/storage.h> | 22 | #include <qpe/storage.h> |
23 | #include <kglobal.h> | 23 | #include <kglobal.h> |
24 | #include <klocale.h> | 24 | #include <klocale.h> |
25 | 25 | ||
26 | #include "ofileselector_p.h" | 26 | #include "ofileselector_p.h" |
27 | //US#include "ofileselector.h" | 27 | //US#include "ofileselector.h" |
28 | 28 | ||
29 | #include "klocale.h" | 29 | #include "klocale.h" |
30 | 30 | ||
31 | OFileViewInterface::OFileViewInterface( OFileSelector* selector ) | 31 | OFileViewInterface::OFileViewInterface( OFileSelector* selector ) |
32 | : m_selector( selector ) { | 32 | : m_selector( selector ) { |
33 | } | 33 | } |
34 | OFileViewInterface::~OFileViewInterface() { | 34 | OFileViewInterface::~OFileViewInterface() { |
35 | } | 35 | } |
36 | QString OFileViewInterface::name()const{ | 36 | QString OFileViewInterface::name()const{ |
37 | return m_name; | 37 | return m_name; |
38 | } | 38 | } |
39 | void OFileViewInterface::setName( const QString& name ) { | 39 | void OFileViewInterface::setName( const QString& name ) { |
40 | m_name = name; | 40 | m_name = name; |
41 | } | 41 | } |
42 | OFileSelector* OFileViewInterface::selector()const { | 42 | OFileSelector* OFileViewInterface::selector()const { |
43 | return m_selector; | 43 | return m_selector; |
44 | } | 44 | } |
45 | 45 | ||
46 | DocLnk OFileViewInterface::selectedDocument()const { | 46 | DocLnk OFileViewInterface::selectedDocument()const { |
47 | return DocLnk( selectedName() ); | 47 | return DocLnk( selectedName() ); |
48 | } | 48 | } |
49 | 49 | ||
50 | bool OFileViewInterface::showNew()const { | 50 | bool OFileViewInterface::showNew()const { |
51 | return selector()->showNew(); | 51 | return selector()->showNew(); |
52 | } | 52 | } |
53 | bool OFileViewInterface::showClose()const { | 53 | bool OFileViewInterface::showClose()const { |
54 | return selector()->showClose(); | 54 | return selector()->showClose(); |
55 | } | 55 | } |
56 | MimeTypes OFileViewInterface::mimeTypes()const { | 56 | MimeTypes OFileViewInterface::mimeTypes()const { |
57 | return selector()->mimeTypes(); | 57 | return selector()->mimeTypes(); |
58 | } | 58 | } |
59 | QStringList OFileViewInterface::currentMimeType()const { | 59 | QStringList OFileViewInterface::currentMimeType()const { |
60 | return selector()->currentMimeType(); | 60 | return selector()->currentMimeType(); |
61 | } | 61 | } |
62 | void OFileViewInterface::activate( const QString& ) { | 62 | void OFileViewInterface::activate( const QString& ) { |
63 | // not implemented here | 63 | // not implemented here |
64 | } | 64 | } |
65 | void OFileViewInterface::ok() { | 65 | void OFileViewInterface::ok() { |
66 | emit selector()->ok(); | 66 | emit selector()->ok(); |
67 | } | 67 | } |
68 | void OFileViewInterface::cancel() { | 68 | void OFileViewInterface::cancel() { |
69 | emit selector()->cancel(); | 69 | emit selector()->cancel(); |
70 | } | 70 | } |
71 | void OFileViewInterface::closeMe() { | 71 | void OFileViewInterface::closeMe() { |
72 | emit selector()->closeMe(); | 72 | emit selector()->closeMe(); |
73 | } | 73 | } |
74 | void OFileViewInterface::fileSelected( const QString& str) { | 74 | void OFileViewInterface::fileSelected( const QString& str) { |
75 | emit selector()->fileSelected( str); | 75 | emit selector()->fileSelected( str); |
76 | } | 76 | } |
77 | void OFileViewInterface::fileSelected( const DocLnk& lnk) { | 77 | void OFileViewInterface::fileSelected( const DocLnk& lnk) { |
78 | emit selector()->fileSelected( lnk ); | 78 | emit selector()->fileSelected( lnk ); |
79 | } | 79 | } |
80 | void OFileViewInterface::setCurrentFileName( const QString& str ) { | 80 | void OFileViewInterface::setCurrentFileName( const QString& str ) { |
81 | selector()->m_lneEdit->setText( str ); | 81 | selector()->m_lneEdit->setText( str ); |
82 | } | 82 | } |
83 | QString OFileViewInterface::currentFileName()const{ | 83 | QString OFileViewInterface::currentFileName()const{ |
84 | return selector()->m_lneEdit->text(); | 84 | return selector()->m_lneEdit->text(); |
85 | } | 85 | } |
86 | QString OFileViewInterface::startDirectory()const{ | 86 | QString OFileViewInterface::startDirectory()const{ |
87 | return selector()->m_startDir; | 87 | return selector()->m_startDir; |
88 | } | 88 | } |
89 | 89 | ||
90 | 90 | ||
91 | ODocumentFileView::ODocumentFileView( OFileSelector* selector ) | 91 | ODocumentFileView::ODocumentFileView( OFileSelector* selector ) |
92 | : OFileViewInterface( selector ) { | 92 | : OFileViewInterface( selector ) { |
93 | m_selector = 0; | 93 | m_selector = 0; |
94 | setName( i18n("Documents") ); | 94 | setName( i18n("Documents") ); |
95 | } | 95 | } |
96 | ODocumentFileView::~ODocumentFileView() { | 96 | ODocumentFileView::~ODocumentFileView() { |
97 | 97 | ||
98 | } | 98 | } |
99 | QString ODocumentFileView::selectedName()const { | 99 | QString ODocumentFileView::selectedName()const { |
100 | if (!m_selector) | 100 | if (!m_selector) |
101 | return QString::null; | 101 | return QString::null; |
102 | 102 | ||
103 | return m_selector->selected()->file(); | 103 | return m_selector->selected()->file(); |
104 | } | 104 | } |
105 | QString ODocumentFileView::selectedPath()const { | 105 | QString ODocumentFileView::selectedPath()const { |
106 | return QPEApplication::documentDir(); | 106 | return QPEApplication::documentDir(); |
107 | } | 107 | } |
108 | QString ODocumentFileView::directory()const { | 108 | QString ODocumentFileView::directory()const { |
109 | return selectedPath(); | 109 | return selectedPath(); |
110 | } | 110 | } |
111 | void ODocumentFileView::reread() { | 111 | void ODocumentFileView::reread() { |
112 | if (!m_selector) | 112 | if (!m_selector) |
113 | return; | 113 | return; |
114 | 114 | ||
115 | m_selector->setNewVisible( showNew() ); | 115 | m_selector->setNewVisible( showNew() ); |
116 | m_selector->setCloseVisible( showClose() ); | 116 | m_selector->setCloseVisible( showClose() ); |
117 | m_selector->filter = currentMimeType().join(";"); | 117 | m_selector->filter = currentMimeType().join(";"); |
118 | m_selector->reread(); | 118 | m_selector->reread(); |
119 | } | 119 | } |
120 | int ODocumentFileView::fileCount()const { | 120 | int ODocumentFileView::fileCount()const { |
121 | if (!m_selector) | 121 | if (!m_selector) |
122 | return -1; | 122 | return -1; |
123 | 123 | ||
124 | return m_selector->fileCount(); | 124 | return m_selector->fileCount(); |
125 | } | 125 | } |
126 | 126 | ||
127 | DocLnk ODocumentFileView::selectedDocument()const { | 127 | DocLnk ODocumentFileView::selectedDocument()const { |
128 | if (!m_selector) | 128 | if (!m_selector) |
129 | return DocLnk(); | 129 | return DocLnk(); |
130 | DocLnk lnk = *m_selector->selected(); | 130 | DocLnk lnk = *m_selector->selected(); |
131 | return lnk; | 131 | return lnk; |
132 | } | 132 | } |
133 | 133 | ||
134 | QWidget* ODocumentFileView::widget( QWidget* parent ) { | 134 | QWidget* ODocumentFileView::widget( QWidget* parent ) { |
135 | if (!m_selector ) { | 135 | if (!m_selector ) { |
136 | m_selector = new FileSelector(currentMimeType().join(";"), parent, "fileselector", showNew(), showClose() ); | 136 | m_selector = new FileSelector(currentMimeType().join(";"), parent, "fileselector", showNew(), showClose() ); |
137 | QObject::connect(m_selector, SIGNAL(fileSelected( const DocLnk& ) ), | 137 | QObject::connect(m_selector, SIGNAL(fileSelected( const DocLnk& ) ), |
138 | selector(), SLOT(slotDocLnkBridge(const DocLnk&) ) ); | 138 | selector(), SLOT(slotDocLnkBridge(const DocLnk&) ) ); |
139 | QObject::connect(m_selector, SIGNAL(closeMe() ), | 139 | QObject::connect(m_selector, SIGNAL(closeMe() ), |
140 | selector(), SIGNAL(closeMe() ) ); | 140 | selector(), SIGNAL(closeMe() ) ); |
141 | QObject::connect(m_selector, SIGNAL(newSelected(const DocLnk& ) ), | 141 | QObject::connect(m_selector, SIGNAL(newSelected(const DocLnk& ) ), |
142 | selector(), SIGNAL(newSelected(const DocLnk& ) ) ); | 142 | selector(), SIGNAL(newSelected(const DocLnk& ) ) ); |
143 | } | 143 | } |
144 | 144 | ||
145 | return m_selector; | 145 | return m_selector; |
146 | } | 146 | } |
147 | 147 | ||
148 | /* | 148 | /* |
149 | * This is the file system view used | 149 | * This is the file system view used |
150 | * we use a QListView + QListViewItems for it | 150 | * we use a QListView + QListViewItems for it |
151 | */ | 151 | */ |
152 | 152 | ||
153 | OFileSelectorItem::OFileSelectorItem( QListView* view, const QPixmap& pixmap, | 153 | OFileSelectorItem::OFileSelectorItem( QListView* view, const QPixmap& pixmap, |
154 | const QString& path, const QString& date, | 154 | const QString& path, const QString& date, |
155 | const QString& size, const QString& dir, | 155 | const QString& size, const QString& dir, |
156 | bool isLocked, bool isDir ) | 156 | bool isLocked, bool isDir ) |
157 | : QListViewItem( view ) | 157 | : QListViewItem( view ) |
158 | { | 158 | { |
159 | |||
160 | QString kind; | ||
161 | QString _path = path; | ||
162 | if ( isDir ) | ||
163 | kind = "dir"; | ||
164 | else | ||
165 | kind = "file"; | ||
159 | setPixmap(0, pixmap ); | 166 | setPixmap(0, pixmap ); |
160 | setText(1, path ); | 167 | int arrow = path.find( "->" ); |
168 | if (arrow > 0 ) { | ||
169 | kind += path.mid( arrow ); | ||
170 | _path = path.left(arrow); | ||
171 | } | ||
172 | setText(1, _path ); | ||
161 | setText(2, size ); | 173 | setText(2, size ); |
162 | setText(3, date ); | 174 | setText(3, date ); |
175 | setText(4, kind ); | ||
163 | m_isDir = isDir; | 176 | m_isDir = isDir; |
164 | m_dir = dir; | 177 | m_dir = dir; |
165 | m_locked = isLocked; | 178 | m_locked = isLocked; |
166 | } | 179 | } |
167 | OFileSelectorItem::~OFileSelectorItem() { | 180 | OFileSelectorItem::~OFileSelectorItem() { |
168 | 181 | ||
169 | } | 182 | } |
170 | bool OFileSelectorItem::isLocked()const { | 183 | bool OFileSelectorItem::isLocked()const { |
171 | return m_locked; | 184 | return m_locked; |
172 | } | 185 | } |
173 | QString OFileSelectorItem::directory()const { | 186 | QString OFileSelectorItem::directory()const { |
174 | return m_dir; | 187 | return m_dir; |
175 | } | 188 | } |
176 | bool OFileSelectorItem::isDir()const { | 189 | bool OFileSelectorItem::isDir()const { |
177 | return m_isDir; | 190 | return m_isDir; |
178 | } | 191 | } |
179 | QString OFileSelectorItem::path()const { | 192 | QString OFileSelectorItem::path()const { |
180 | return text( 1 ); | 193 | return text( 1 ); |
181 | } | 194 | } |
182 | QString OFileSelectorItem::key( int id, bool )const { | 195 | QString OFileSelectorItem::key( int id, bool )const { |
183 | QString ke; | 196 | QString ke; |
184 | if( id == 0 || id == 1 ){ // name | 197 | if( id == 0 || id == 1 ){ // name |
185 | if( m_isDir ){ | 198 | if( m_isDir ){ |
186 | ke.append("0" ); | 199 | ke.append("0" ); |
187 | ke.append( text(1) ); | 200 | ke.append( text(1) ); |
188 | }else{ | 201 | }else{ |
189 | ke.append("1" ); | 202 | ke.append("1" ); |
190 | ke.append( text(1) ); | 203 | ke.append( text(1) ); |
191 | } | 204 | } |
192 | return ke; | 205 | return ke; |
193 | }else | 206 | } else if ( id == 2 ) { |
207 | QString sort = "00000000"; | ||
208 | sort = sort.left( 9-text( 2 ).length()) + text( 2 ); | ||
209 | return sort; | ||
210 | |||
211 | } else | ||
194 | return text( id ); | 212 | return text( id ); |
195 | 213 | ||
196 | } | 214 | } |
197 | 215 | ||
198 | OFileViewFileListView::OFileViewFileListView( QWidget* parent, const QString& startDir, | 216 | OFileViewFileListView::OFileViewFileListView( QWidget* parent, const QString& startDir, |
199 | OFileSelector* sel) | 217 | OFileSelector* sel) |
200 | : QWidget( parent ), m_sel( sel ) { | 218 | : QWidget( parent ), m_sel( sel ) { |
201 | m_all = false; | 219 | m_all = false; |
202 | QVBoxLayout* lay = new QVBoxLayout( this ); | 220 | QVBoxLayout* lay = new QVBoxLayout( this ); |
203 | m_currentDir = startDir; | 221 | m_currentDir = startDir; |
204 | 222 | ||
205 | /* | 223 | /* |
206 | * now we add a special bar | 224 | * now we add a special bar |
207 | * One Button For Up | 225 | * One Button For Up |
208 | * Home | 226 | * Home |
209 | * Doc | 227 | * Doc |
210 | * And a dropdown menu with FileSystems | 228 | * And a dropdown menu with FileSystems |
211 | * FUTURE: one to change dir with lineedit | 229 | * FUTURE: one to change dir with lineedit |
212 | * Bookmarks | 230 | * Bookmarks |
213 | * Create Dir | 231 | * Create Dir |
214 | */ | 232 | */ |
215 | QHBox* box = new QHBox(this ); | 233 | QHBox* box = new QHBox(this ); |
216 | box->setBackgroundMode( PaletteButton ); | 234 | box->setBackgroundMode( PaletteButton ); |
217 | box->setSpacing( 0 ); | 235 | box->setSpacing( 0 ); |
218 | 236 | ||
219 | QToolButton *btn = new QToolButton( box ); | 237 | QToolButton *btn = new QToolButton( box ); |
220 | btn->setIconSet( Resource::loadPixmap("up") ); | 238 | btn->setIconSet( Resource::loadPixmap("up") ); |
221 | connect(btn, SIGNAL(clicked() ), | 239 | connect(btn, SIGNAL(clicked() ), |
222 | this, SLOT( cdUP() ) ); | 240 | this, SLOT( cdUP() ) ); |
223 | 241 | ||
224 | btn = new QToolButton( box ); | 242 | btn = new QToolButton( box ); |
225 | btn->setIconSet( Resource::loadPixmap("home") ); | 243 | btn->setIconSet( Resource::loadPixmap("home") ); |
226 | connect(btn, SIGNAL(clicked() ), | 244 | connect(btn, SIGNAL(clicked() ), |
227 | this, SLOT( cdHome() ) ); | 245 | this, SLOT( cdHome() ) ); |
228 | 246 | ||
229 | btn = new QToolButton( box ); | 247 | btn = new QToolButton( box ); |
230 | btn->setIconSet( Resource::loadPixmap("DocsIcon") ); | 248 | btn->setIconSet( Resource::loadPixmap("DocsIcon") ); |
231 | connect(btn, SIGNAL(clicked() ), | 249 | connect(btn, SIGNAL(clicked() ), |
232 | this, SLOT(cdDoc() ) ); | 250 | this, SLOT(cdDoc() ) ); |
233 | 251 | ||
234 | m_btnNew = new QToolButton( box ); | 252 | m_btnNew = new QToolButton( box ); |
235 | m_btnNew->setIconSet( Resource::loadPixmap("new") ); | 253 | m_btnNew->setIconSet( Resource::loadPixmap("new") ); |
236 | connect(m_btnNew, SIGNAL(clicked() ), | 254 | connect(m_btnNew, SIGNAL(clicked() ), |
237 | this, SLOT(slotNew() ) ); | 255 | this, SLOT(slotNew() ) ); |
238 | 256 | ||
239 | 257 | ||
240 | m_btnClose = new QToolButton( box ); | 258 | m_btnClose = new QToolButton( box ); |
241 | m_btnClose->setIconSet( Resource::loadPixmap("close") ); | 259 | m_btnClose->setIconSet( Resource::loadPixmap("close") ); |
242 | connect(m_btnClose, SIGNAL(clicked() ), | 260 | connect(m_btnClose, SIGNAL(clicked() ), |
243 | selector(), SIGNAL(closeMe() ) ); | 261 | selector(), SIGNAL(closeMe() ) ); |
244 | 262 | ||
245 | btn = new QToolButton( box ); | 263 | btn = new QToolButton( box ); |
246 | btn->setIconSet( Resource::loadPixmap("cardmon/pcmcia") ); | 264 | btn->setIconSet( Resource::loadPixmap("cardmon/pcmcia") ); |
247 | 265 | ||
248 | /* let's fill device parts */ | 266 | /* let's fill device parts */ |
249 | QPopupMenu* pop = new QPopupMenu(this); | 267 | QPopupMenu* pop = new QPopupMenu(this); |
250 | connect(pop, SIGNAL( activated(int) ), | 268 | connect(pop, SIGNAL( activated(int) ), |
251 | this, SLOT(slotFSActivated(int) ) ); | 269 | this, SLOT(slotFSActivated(int) ) ); |
252 | 270 | ||
253 | StorageInfo storage; | 271 | StorageInfo storage; |
254 | const QList<FileSystem> &fs = storage.fileSystems(); | 272 | const QList<FileSystem> &fs = storage.fileSystems(); |
255 | QListIterator<FileSystem> it(fs); | 273 | QListIterator<FileSystem> it(fs); |
256 | for ( ; it.current(); ++it ) { | 274 | for ( ; it.current(); ++it ) { |
257 | const QString disk = (*it)->name(); | 275 | const QString disk = (*it)->name(); |
258 | const QString path = (*it)->path(); | 276 | const QString path = (*it)->path(); |
259 | m_dev.insert( disk, path ); | 277 | m_dev.insert( disk, path ); |
260 | pop->insertItem( disk ); | 278 | pop->insertItem( disk ); |
261 | } | 279 | } |
262 | m_fsPop = pop; | 280 | m_fsPop = pop; |
263 | 281 | ||
264 | 282 | ||
265 | btn->setPopup( pop ); | 283 | btn->setPopup( pop ); |
266 | btn->setPopupDelay ( 0 ); | 284 | btn->setPopupDelay ( 0 ); |
267 | lay->addWidget( box ); | 285 | lay->addWidget( box ); |
268 | 286 | ||
269 | m_view = new QListView( this ); | 287 | m_view = new QListView( this ); |
270 | 288 | ||
271 | m_view->installEventFilter(this); | 289 | m_view->installEventFilter(this); |
272 | 290 | ||
273 | QPEApplication::setStylusOperation( m_view->viewport(), | 291 | QPEApplication::setStylusOperation( m_view->viewport(), |
274 | QPEApplication::RightOnHold); | 292 | QPEApplication::RightOnHold); |
275 | m_view->addColumn(" " ); | 293 | m_view->addColumn(" " ); |
276 | m_view->addColumn(i18n("Name"), 135 ); | 294 | m_view->addColumn(i18n("Name"), 135 ); |
277 | m_view->addColumn(i18n("Size"), -1 ); | 295 | m_view->addColumn(i18n("Size"), -1 ); |
278 | m_view->addColumn(i18n("Date"), 60 ); | 296 | m_view->addColumn(i18n("Date"), 60 ); |
279 | m_view->addColumn(i18n("Mime Type"), -1 ); | 297 | m_view->addColumn(i18n("Mime Type"), -1 ); |
280 | 298 | ||
281 | 299 | ||
282 | m_view->setSorting( 1 ); | 300 | m_view->setSorting( 1 ); |
283 | m_view->setAllColumnsShowFocus( TRUE ); | 301 | m_view->setAllColumnsShowFocus( TRUE ); |
284 | 302 | ||
285 | lay->addWidget( m_view, 1000 ); | 303 | lay->addWidget( m_view, 1000 ); |
286 | connectSlots(); | 304 | connectSlots(); |
287 | } | 305 | } |
288 | OFileViewFileListView::~OFileViewFileListView() { | 306 | OFileViewFileListView::~OFileViewFileListView() { |
289 | } | 307 | } |
290 | void OFileViewFileListView::slotNew() { | 308 | void OFileViewFileListView::slotNew() { |
291 | DocLnk lnk; | 309 | DocLnk lnk; |
292 | emit selector()->newSelected( lnk ); | 310 | emit selector()->newSelected( lnk ); |
293 | } | 311 | } |
294 | OFileSelectorItem* OFileViewFileListView::currentItem()const{ | 312 | OFileSelectorItem* OFileViewFileListView::currentItem()const{ |
295 | QListViewItem* item = m_view->currentItem(); | 313 | QListViewItem* item = m_view->currentItem(); |
296 | if (!item ) | 314 | if (!item ) |
297 | return 0l; | 315 | return 0l; |
298 | 316 | ||
299 | return static_cast<OFileSelectorItem*>(item); | 317 | return static_cast<OFileSelectorItem*>(item); |
300 | } | 318 | } |
301 | void OFileViewFileListView::reread( bool all ) { | 319 | void OFileViewFileListView::reread( bool all ) { |
302 | m_view->clear(); | 320 | m_view->clear(); |
303 | 321 | ||
304 | if (selector()->showClose() ) | 322 | if (selector()->showClose() ) |
305 | m_btnClose->show(); | 323 | m_btnClose->show(); |
306 | else | 324 | else |
307 | m_btnClose->hide(); | 325 | m_btnClose->hide(); |
308 | 326 | ||
309 | if (selector()->showNew() ) | 327 | if (selector()->showNew() ) |
310 | m_btnNew->show(); | 328 | m_btnNew->show(); |
311 | else | 329 | else |
312 | m_btnNew->hide(); | 330 | m_btnNew->hide(); |
313 | 331 | ||
314 | m_mimes = selector()->currentMimeType(); | 332 | m_mimes = selector()->currentMimeType(); |
315 | m_all = all; | 333 | m_all = all; |
316 | 334 | ||
317 | QDir dir( m_currentDir ); | 335 | QDir dir( m_currentDir ); |
318 | if (!dir.exists() ) | 336 | if (!dir.exists() ) |
319 | return; | 337 | return; |
320 | topLevelWidget()->setCaption( dir.path() ); | 338 | topLevelWidget()->setCaption( dir.path() ); |
321 | dir.setSorting( QDir::Name | QDir::DirsFirst | QDir::Reversed ); | 339 | dir.setSorting( QDir::Name | QDir::DirsFirst | QDir::Reversed ); |
322 | int filter; | 340 | int filter; |
323 | if (m_all ) | 341 | if (m_all ) |
324 | filter = QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All; | 342 | filter = QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All; |
325 | else | 343 | else |
326 | filter = QDir::Files | QDir::Dirs | QDir::All; | 344 | filter = QDir::Files | QDir::Dirs | QDir::All; |
327 | dir.setFilter( filter ); | 345 | dir.setFilter( filter ); |
328 | 346 | ||
329 | // now go through all files | 347 | // now go through all files |
330 | const QFileInfoList *list = dir.entryInfoList(); | 348 | const QFileInfoList *list = dir.entryInfoList(); |
331 | if (!list) { | 349 | if (!list) { |
332 | cdUP(); | 350 | cdUP(); |
333 | return; | 351 | return; |
334 | } | 352 | } |
335 | QFileInfoListIterator it( *list ); | 353 | QFileInfoListIterator it( *list ); |
336 | QFileInfo *fi; | 354 | QFileInfo *fi; |
337 | while( (fi=it.current() ) ){ | 355 | while( (fi=it.current() ) ){ |
338 | if( fi->fileName() == QString::fromLatin1("..") || fi->fileName() == QString::fromLatin1(".") ){ | 356 | if( fi->fileName() == QString::fromLatin1("..") || fi->fileName() == QString::fromLatin1(".") ){ |
339 | ++it; | 357 | ++it; |
340 | continue; | 358 | continue; |
341 | } | 359 | } |
342 | 360 | ||
343 | /* | 361 | /* |
344 | * It is a symlink we try to resolve it now but don't let us attack by DOS | 362 | * It is a symlink we try to resolve it now but don't let us attack by DOS |
345 | * | 363 | * |
346 | */ | 364 | */ |
347 | if( fi->isSymLink() ){ | 365 | if( fi->isSymLink() ){ |
348 | QString file = fi->dirPath( true ) + "/" + fi->readLink(); | 366 | qDebug("SYMLINK "); |
349 | for( int i = 0; i<=4; i++) { // 5 tries to prevent dos | 367 | QString file = fi->readLink(); |
368 | for( int i = 0; i<=5; i++) { // 5 tries to prevent dos | ||
350 | QFileInfo info( file ); | 369 | QFileInfo info( file ); |
370 | qDebug("FILE %s ", file.latin1()); | ||
351 | if( !info.exists() ){ | 371 | if( !info.exists() ){ |
352 | addSymlink( fi, TRUE ); | 372 | addSymlink( fi, TRUE ); |
353 | break; | 373 | break; |
354 | }else if( info.isDir() ){ | 374 | }else if( info.isDir() ){ |
355 | addDir( fi, TRUE ); | 375 | addDir( fi, TRUE ); |
356 | break; | 376 | break; |
357 | }else if( info.isFile() ){ | 377 | }else if( info.isFile() ){ |
358 | addFile( fi, TRUE ); | 378 | addFile( fi, TRUE ); |
359 | break; | 379 | break; |
360 | }else if( info.isSymLink() ){ | 380 | }else if( info.isSymLink() ){ |
361 | file = info.dirPath(true ) + "/" + info.readLink() ; | 381 | file = info.readLink() ; |
362 | break; | 382 | break; |
363 | }else if( i == 4){ // couldn't resolve symlink add it as symlink | 383 | }else if( i == 4){ // couldn't resolve symlink add it as symlink |
364 | addSymlink( fi ); | 384 | addSymlink( fi ); |
365 | } | 385 | } |
366 | } // off for loop for symlink resolving | 386 | } // off for loop for symlink resolving |
367 | }else if( fi->isDir() ) | 387 | }else if( fi->isDir() ) |
368 | addDir( fi ); | 388 | addDir( fi ); |
369 | else if( fi->isFile() ) | 389 | else if( fi->isFile() ) |
370 | addFile( fi ); | 390 | addFile( fi ); |
371 | 391 | ||
372 | ++it; | 392 | ++it; |
373 | } // of while loop | 393 | } // of while loop |
374 | m_view->sort(); | 394 | m_view->sort(); |
375 | 395 | ||
376 | } | 396 | } |
377 | int OFileViewFileListView::fileCount()const{ | 397 | int OFileViewFileListView::fileCount()const{ |
378 | return m_view->childCount(); | 398 | return m_view->childCount(); |
379 | } | 399 | } |
380 | QString OFileViewFileListView::currentDir()const{ | 400 | QString OFileViewFileListView::currentDir()const{ |
381 | return m_currentDir; | 401 | return m_currentDir; |
382 | } | 402 | } |
383 | OFileSelector* OFileViewFileListView::selector() { | 403 | OFileSelector* OFileViewFileListView::selector() { |
384 | return m_sel; | 404 | return m_sel; |
385 | } | 405 | } |
386 | 406 | ||
387 | bool OFileViewFileListView::eventFilter (QObject *o, QEvent *e) { | 407 | bool OFileViewFileListView::eventFilter (QObject *o, QEvent *e) { |
388 | #if 0 | 408 | #if 0 |
389 | if ( e->type() == QEvent::KeyPress ) { | 409 | if ( e->type() == QEvent::KeyPress ) { |
390 | QKeyEvent *k = (QKeyEvent *)e; | 410 | QKeyEvent *k = (QKeyEvent *)e; |
391 | if ( (k->key()==Key_Enter) || (k->key()==Key_Return)) { | 411 | if ( (k->key()==Key_Enter) || (k->key()==Key_Return)) { |
392 | slotClicked( Qt::LeftButton,m_view->currentItem(),QPoint(0,0),0); | 412 | slotClicked( Qt::LeftButton,m_view->currentItem(),QPoint(0,0),0); |
393 | return true; | 413 | return true; |
394 | } | 414 | } |
395 | } | 415 | } |
396 | #endif | 416 | #endif |
397 | return false; | 417 | return false; |
398 | } | 418 | } |
399 | 419 | ||
400 | 420 | ||
401 | void OFileViewFileListView::connectSlots() { | 421 | void OFileViewFileListView::connectSlots() { |
402 | connect(m_view, SIGNAL(clicked(QListViewItem*) ), | 422 | connect(m_view, SIGNAL(clicked(QListViewItem*) ), |
403 | this, SLOT(slotCurrentChanged(QListViewItem*) ) ); | 423 | this, SLOT(slotCurrentChanged(QListViewItem*) ) ); |
404 | connect(m_view, SIGNAL(mouseButtonClicked(int, QListViewItem*, const QPoint&, int ) ), | 424 | connect(m_view, SIGNAL(mouseButtonClicked(int, QListViewItem*, const QPoint&, int ) ), |
405 | this, SLOT(slotClicked(int, QListViewItem*, const QPoint&, int ) ) ); | 425 | this, SLOT(slotClicked(int, QListViewItem*, const QPoint&, int ) ) ); |
406 | connect(m_view, SIGNAL(doubleClicked( QListViewItem* )), | 426 | connect(m_view, SIGNAL(doubleClicked( QListViewItem* )), |
407 | this, SLOT(slotDoubleClicked(QListViewItem* ) ) ); | 427 | this, SLOT(slotDoubleClicked(QListViewItem* ) ) ); |
408 | connect(m_view, SIGNAL(returnPressed( QListViewItem* )), | 428 | connect(m_view, SIGNAL(returnPressed( QListViewItem* )), |
409 | this, SLOT(slotDoubleClicked(QListViewItem* ) ) ); | 429 | this, SLOT(slotDoubleClicked(QListViewItem* ) ) ); |
410 | } | 430 | } |
411 | void OFileViewFileListView::slotCurrentChanged( QListViewItem* item) { | 431 | void OFileViewFileListView::slotCurrentChanged( QListViewItem* item) { |
412 | if (!item) | 432 | if (!item) |
413 | return; | 433 | return; |
414 | #if 0 | 434 | #if 0 |
415 | 435 | ||
416 | OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item); | 436 | OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item); |
417 | 437 | ||
418 | if (!sel->isDir() ) { | 438 | if (!sel->isDir() ) { |
419 | selector()->m_lneEdit->setText( sel->text(1) ); | 439 | selector()->m_lneEdit->setText( sel->text(1) ); |
420 | // if in fileselector mode we will emit selected | 440 | // if in fileselector mode we will emit selected |
421 | if ( selector()->mode() == OFileSelector::FileSelector ) { | 441 | if ( selector()->mode() == OFileSelector::FileSelector ) { |
422 | qWarning("slot Current Changed"); | 442 | qWarning("slot Current Changed"); |
423 | QStringList str = QStringList::split("->", sel->text(1) ); | 443 | QStringList str = QStringList::split("->", sel->text(1) ); |
424 | QString path = sel->directory() + "/" + str[0].stripWhiteSpace(); | 444 | QString path = sel->directory() + "/" + str[0].stripWhiteSpace(); |
425 | emit selector()->fileSelected( path ); | 445 | emit selector()->fileSelected( path ); |
426 | DocLnk lnk( path ); | 446 | DocLnk lnk( path ); |
427 | emit selector()->fileSelected( lnk ); | 447 | emit selector()->fileSelected( lnk ); |
428 | } | 448 | } |
429 | } | 449 | } |
430 | #endif | 450 | #endif |
431 | } | 451 | } |
432 | void OFileViewFileListView::slotDoubleClicked(QListViewItem* item ) { | 452 | void OFileViewFileListView::slotDoubleClicked(QListViewItem* item ) { |
433 | if (!item ) return; | 453 | if (!item ) return; |
434 | OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item); | 454 | OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item); |
435 | if (!sel->isLocked() ) { | 455 | if (!sel->isLocked() ) { |
436 | QStringList str = QStringList::split("->", sel->text(1) ); | 456 | QStringList str = QStringList::split("->", sel->text(1) ); |
437 | if (sel->isDir() ) { | 457 | if (sel->isDir() ) { |
438 | m_currentDir = sel->directory() + "/" + str[0].stripWhiteSpace(); | 458 | m_currentDir = sel->directory() + "/" + str[0].stripWhiteSpace(); |
439 | emit selector()->dirSelected( m_currentDir ); | 459 | emit selector()->dirSelected( m_currentDir ); |
440 | reread( m_all ); | 460 | reread( m_all ); |
441 | }else { // file | 461 | }else { // file |
442 | //qWarning("slot Clicked"); | 462 | //qWarning("slot Clicked"); |
443 | selector()->m_lneEdit->setText( str[0].stripWhiteSpace() ); | 463 | selector()->m_lneEdit->setText( str[0].stripWhiteSpace() ); |
444 | QString path = sel->directory() + "/" + str[0].stripWhiteSpace(); | 464 | QString path = sel->directory() + "/" + str[0].stripWhiteSpace(); |
445 | emit selector()->fileSelected( path ); | 465 | emit selector()->fileSelected( path ); |
446 | DocLnk lnk( path ); | 466 | DocLnk lnk( path ); |
447 | emit selector()->fileSelected( lnk ); | 467 | emit selector()->fileSelected( lnk ); |
448 | emit selector()->ok(); | 468 | emit selector()->ok(); |
449 | } | 469 | } |
450 | } // not locked | 470 | } // not locked |
451 | } | 471 | } |
452 | void OFileViewFileListView::slotClicked(int button , QListViewItem* item, const QPoint&, int ) { | 472 | void OFileViewFileListView::slotClicked(int button , QListViewItem* item, const QPoint&, int ) { |
453 | if (!item || ( button != Qt::LeftButton) ) | 473 | if (!item || ( button != Qt::LeftButton) ) |
454 | return; | 474 | return; |
455 | 475 | ||
456 | OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item); | 476 | OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item); |
457 | if (!sel->isLocked() ) { | 477 | if (!sel->isLocked() ) { |
458 | QStringList str = QStringList::split("->", sel->text(1) ); | 478 | QStringList str = QStringList::split("->", sel->text(1) ); |
459 | if (sel->isDir() ) { | 479 | if (sel->isDir() ) { |
460 | m_currentDir = sel->directory() + "/" + str[0].stripWhiteSpace(); | 480 | m_currentDir = sel->directory() + "/" + str[0].stripWhiteSpace(); |
461 | emit selector()->dirSelected( m_currentDir ); | 481 | emit selector()->dirSelected( m_currentDir ); |
462 | reread( m_all ); | 482 | reread( m_all ); |
463 | }else { // file | 483 | }else { // file |
464 | //qWarning("slot Clicked"); | 484 | //qWarning("slot Clicked"); |
465 | selector()->m_lneEdit->setText( str[0].stripWhiteSpace() ); | 485 | selector()->m_lneEdit->setText( str[0].stripWhiteSpace() ); |
466 | QString path = sel->directory() + "/" + str[0].stripWhiteSpace(); | 486 | QString path = sel->directory() + "/" + str[0].stripWhiteSpace(); |
467 | emit selector()->fileSelected( path ); | 487 | emit selector()->fileSelected( path ); |
468 | DocLnk lnk( path ); | 488 | DocLnk lnk( path ); |
469 | emit selector()->fileSelected( lnk ); | 489 | emit selector()->fileSelected( lnk ); |
470 | } | 490 | } |
471 | } // not locked | 491 | } // not locked |
472 | } | 492 | } |
473 | void OFileViewFileListView::addFile( QFileInfo* info, bool symlink ) { | 493 | void OFileViewFileListView::addFile( QFileInfo* info, bool symlink ) { |
474 | MimeType type( info->absFilePath() ); | 494 | MimeType type( info->absFilePath() ); |
475 | if (!compliesMime( type.id() ) ) | 495 | if (!compliesMime( type.id() ) ) |
476 | return; | 496 | return; |
477 | 497 | ||
478 | QPixmap pix = type.pixmap(); | 498 | QPixmap pix = type.pixmap(); |
479 | QString dir, name; bool locked; | 499 | QString dir, name; bool locked; |
480 | if ( pix.isNull() ) { | 500 | if ( pix.isNull() ) { |
481 | QWMatrix matrix; | 501 | QWMatrix matrix; |
482 | QPixmap pixer(Resource::loadPixmap("UnknownDocument") ); | 502 | QPixmap pixer(Resource::loadPixmap("UnknownDocument") ); |
483 | matrix.scale( .4, .4 ); | 503 | matrix.scale( .4, .4 ); |
484 | pix = pixer.xForm( matrix ); | 504 | pix = pixer.xForm( matrix ); |
485 | } | 505 | } |
486 | dir = info->dirPath( true ); | 506 | dir = info->dirPath( true ); |
487 | locked = false; | 507 | locked = false; |
488 | if ( symlink ) | 508 | if ( symlink ) |
489 | name = info->fileName() + " -> " + info->dirPath() + "/" + info->readLink(); | 509 | name = info->fileName() + " -> " + info->readLink(); |
490 | else{ | 510 | else{ |
491 | name = info->fileName(); | 511 | name = info->fileName(); |
492 | if ( ( (selector()->mode() == OFileSelector::Open)&& !info->isReadable() ) || | 512 | if ( ( (selector()->mode() == OFileSelector::Open)&& !info->isReadable() ) || |
493 | ( (selector()->mode() == OFileSelector::Save)&& !info->isWritable() ) ) { | 513 | ( (selector()->mode() == OFileSelector::Save)&& !info->isWritable() ) ) { |
494 | locked = true; pix = Resource::loadPixmap("locked"); | 514 | locked = true; pix = Resource::loadPixmap("locked"); |
495 | } | 515 | } |
496 | } | 516 | } |
497 | (void)new OFileSelectorItem( m_view, pix, name, | 517 | (void)new OFileSelectorItem( m_view, pix, name, |
498 | KGlobal::locale()->formatDateTime(info->lastModified(),true, true, KLocale::ISODate), | 518 | KGlobal::locale()->formatDateTime(info->lastModified(),true, true, KLocale::ISODate), |
499 | QString::number( info->size() ), | 519 | QString::number( info->size() ), |
500 | dir, locked ); | 520 | dir, locked ); |
501 | } | 521 | } |
502 | void OFileViewFileListView::addDir( QFileInfo* info, bool symlink ) { | 522 | void OFileViewFileListView::addDir( QFileInfo* info, bool symlink ) { |
503 | bool locked = false; QString name; QPixmap pix; | 523 | bool locked = false; QString name; QPixmap pix; |
504 | 524 | ||
505 | if ( ( ( selector()->mode() == OFileSelector::Open ) && !info->isReadable() ) || | 525 | if ( ( ( selector()->mode() == OFileSelector::Open ) && !info->isReadable() ) || |
506 | ( ( selector()->mode() == OFileSelector::Save ) && !info->isWritable() ) ) { | 526 | ( ( selector()->mode() == OFileSelector::Save ) && !info->isWritable() ) ) { |
507 | locked = true; | 527 | locked = true; |
508 | if ( symlink ) | 528 | if ( symlink ) |
509 | pix = Resource::loadPixmap( "symlink" ); | 529 | pix = Resource::loadPixmap( "symlink" ); |
510 | else | 530 | else |
511 | pix = Resource::loadPixmap( "lockedfolder" ); | 531 | pix = Resource::loadPixmap( "lockedfolder" ); |
512 | }else | 532 | }else |
513 | pix = symlink ? Resource::loadPixmap( "symlink") : Resource::loadPixmap("folder"); | 533 | pix = symlink ? Resource::loadPixmap( "symlink") : Resource::loadPixmap("folder"); |
514 | 534 | ||
515 | name = symlink ? info->fileName() + " -> " + info->dirPath(true) + "/" + info->readLink() : | 535 | name = symlink ? info->fileName() + " -> " + info->readLink() : |
516 | info->fileName(); | 536 | info->fileName(); |
517 | 537 | ||
518 | (void)new OFileSelectorItem( m_view, pix, name, | 538 | (void)new OFileSelectorItem( m_view, pix, name, |
519 | KGlobal::locale()->formatDateTime(info->lastModified(),true, true, KLocale::ISODate), | 539 | KGlobal::locale()->formatDateTime(info->lastModified(),true, true, KLocale::ISODate), |
520 | QString::number( info->size() ), | 540 | QString::number( info->size() ), |
521 | info->dirPath( true ), locked, true ); | 541 | info->dirPath( true ), locked, true ); |
522 | 542 | ||
523 | 543 | ||
524 | } | 544 | } |
525 | void OFileViewFileListView::addSymlink( QFileInfo* , bool ) { | 545 | void OFileViewFileListView::addSymlink( QFileInfo* , bool ) { |
526 | 546 | ||
527 | } | 547 | } |
528 | void OFileViewFileListView::cdUP() { | 548 | void OFileViewFileListView::cdUP() { |
529 | QDir dir( m_currentDir ); | 549 | QDir dir( m_currentDir ); |
530 | dir.cdUp(); | 550 | dir.cdUp(); |
531 | 551 | ||
532 | if (!dir.exists() ) | 552 | if (!dir.exists() ) |
533 | m_currentDir = "/"; | 553 | m_currentDir = "/"; |
534 | else | 554 | else |
535 | m_currentDir = dir.absPath(); | 555 | m_currentDir = dir.absPath(); |
536 | 556 | ||
537 | emit selector()->dirSelected( m_currentDir ); | 557 | emit selector()->dirSelected( m_currentDir ); |
538 | reread( m_all ); | 558 | reread( m_all ); |
539 | } | 559 | } |
540 | void OFileViewFileListView::cdHome() { | 560 | void OFileViewFileListView::cdHome() { |
541 | m_currentDir = QDir::homeDirPath(); | 561 | m_currentDir = QDir::homeDirPath(); |
542 | emit selector()->dirSelected( m_currentDir ); | 562 | emit selector()->dirSelected( m_currentDir ); |
543 | reread( m_all ); | 563 | reread( m_all ); |
544 | } | 564 | } |
545 | void OFileViewFileListView::cdDoc() { | 565 | void OFileViewFileListView::cdDoc() { |
546 | m_currentDir = QPEApplication::documentDir(); | 566 | m_currentDir = QPEApplication::documentDir(); |
547 | emit selector()->dirSelected( m_currentDir ); | 567 | emit selector()->dirSelected( m_currentDir ); |
548 | reread( m_all ); | 568 | reread( m_all ); |
549 | } | 569 | } |
550 | void OFileViewFileListView::changeDir( const QString& dir ) { | 570 | void OFileViewFileListView::changeDir( const QString& dir ) { |
551 | m_currentDir = dir; | 571 | m_currentDir = dir; |
552 | emit selector()->dirSelected( m_currentDir ); | 572 | emit selector()->dirSelected( m_currentDir ); |
553 | reread( m_all ); | 573 | reread( m_all ); |
554 | } | 574 | } |
555 | void OFileViewFileListView::slotFSActivated( int id ) { | 575 | void OFileViewFileListView::slotFSActivated( int id ) { |
556 | changeDir ( m_dev[m_fsPop->text(id)] ); | 576 | changeDir ( m_dev[m_fsPop->text(id)] ); |
557 | } | 577 | } |
558 | 578 | ||
559 | /* check if the mimetype in mime | 579 | /* check if the mimetype in mime |
560 | * complies with the one which is current | 580 | * complies with the one which is current |
561 | */ | 581 | */ |
562 | /* | 582 | /* |
563 | * We've the mimetype of the file | 583 | * We've the mimetype of the file |
564 | * We need to get the stringlist of the current mimetype | 584 | * We need to get the stringlist of the current mimetype |
565 | * | 585 | * |
566 | * mime = image@slashjpeg | 586 | * mime = image@slashjpeg |
567 | * QStringList = 'image@slash*' | 587 | * QStringList = 'image@slash*' |
568 | * or QStringList = image/jpeg;image/png;application/x-ogg | 588 | * or QStringList = image/jpeg;image/png;application/x-ogg |
569 | * or QStringList = application/x-ogg;image@slash*; | 589 | * or QStringList = application/x-ogg;image@slash*; |
570 | * with all these mime filters it should get acceptes | 590 | * with all these mime filters it should get acceptes |
571 | * to do so we need to look if mime is contained inside | 591 | * to do so we need to look if mime is contained inside |
572 | * the stringlist | 592 | * the stringlist |
573 | * if it's contained return true | 593 | * if it's contained return true |
574 | * if not ( I'm no RegExp expert at all ) we'll look if a '@slash*' | 594 | * if not ( I'm no RegExp expert at all ) we'll look if a '@slash*' |
575 | * is contained in the mimefilter and then we will | 595 | * is contained in the mimefilter and then we will |
576 | * look if both are equal until the '/' | 596 | * look if both are equal until the '/' |
577 | */ | 597 | */ |
578 | bool OFileViewFileListView::compliesMime( const QString& str) { | 598 | bool OFileViewFileListView::compliesMime( const QString& str) { |
579 | if (str.isEmpty() || m_mimes.isEmpty() || str.stripWhiteSpace().isEmpty() ) | 599 | if (str.isEmpty() || m_mimes.isEmpty() || str.stripWhiteSpace().isEmpty() ) |
580 | return true; | 600 | return true; |
581 | 601 | ||
582 | for (QStringList::Iterator it = m_mimes.begin(); it != m_mimes.end(); ++it ) { | 602 | for (QStringList::Iterator it = m_mimes.begin(); it != m_mimes.end(); ++it ) { |
583 | QRegExp reg( (*it) ); | 603 | QRegExp reg( (*it) ); |
584 | reg.setWildcard( true ); | 604 | reg.setWildcard( true ); |
585 | if ( str.find( reg ) != -1 ) | 605 | if ( str.find( reg ) != -1 ) |
586 | return true; | 606 | return true; |
587 | 607 | ||
588 | } | 608 | } |
589 | return false; | 609 | return false; |
590 | } | 610 | } |
591 | /* | 611 | /* |
592 | * The listView giving access to the file system! | 612 | * The listView giving access to the file system! |
593 | */ | 613 | */ |
594 | class OFileViewFileSystem : public OFileViewInterface { | 614 | class OFileViewFileSystem : public OFileViewInterface { |
595 | public: | 615 | public: |
596 | OFileViewFileSystem( OFileSelector* ); | 616 | OFileViewFileSystem( OFileSelector* ); |
597 | ~OFileViewFileSystem(); | 617 | ~OFileViewFileSystem(); |
598 | 618 | ||
599 | QString selectedName() const; | 619 | QString selectedName() const; |
600 | QString selectedPath() const; | 620 | QString selectedPath() const; |
601 | 621 | ||
602 | QString directory()const; | 622 | QString directory()const; |
603 | void reread(); | 623 | void reread(); |
604 | int fileCount()const; | 624 | int fileCount()const; |
605 | 625 | ||
606 | QWidget* widget( QWidget* parent ); | 626 | QWidget* widget( QWidget* parent ); |
607 | void activate( const QString& ); | 627 | void activate( const QString& ); |
608 | private: | 628 | private: |
609 | OFileViewFileListView* m_view; | 629 | OFileViewFileListView* m_view; |
610 | bool m_all : 1; | 630 | bool m_all : 1; |
611 | }; | 631 | }; |
612 | OFileViewFileSystem::OFileViewFileSystem( OFileSelector* sel) | 632 | OFileViewFileSystem::OFileViewFileSystem( OFileSelector* sel) |
613 | : OFileViewInterface( sel ) { | 633 | : OFileViewInterface( sel ) { |
614 | m_view = 0; | 634 | m_view = 0; |
615 | m_all = false; | 635 | m_all = false; |
616 | } | 636 | } |
617 | OFileViewFileSystem::~OFileViewFileSystem() { | 637 | OFileViewFileSystem::~OFileViewFileSystem() { |
618 | } | 638 | } |
619 | QString OFileViewFileSystem::selectedName()const{ | 639 | QString OFileViewFileSystem::selectedName()const{ |
620 | if (!m_view ) | 640 | if (!m_view ) |
621 | return QString::null; | 641 | return QString::null; |
622 | 642 | ||
623 | QString cFN=currentFileName(); | 643 | QString cFN=currentFileName(); |
624 | if (cFN.startsWith("/")) return cFN; | 644 | if (cFN.startsWith("/")) return cFN; |
625 | return m_view->currentDir() + "/" + cFN; | 645 | return m_view->currentDir() + "/" + cFN; |
626 | } | 646 | } |
627 | QString OFileViewFileSystem::selectedPath()const{ | 647 | QString OFileViewFileSystem::selectedPath()const{ |
628 | return QString::null; | 648 | return QString::null; |
629 | } | 649 | } |
630 | QString OFileViewFileSystem::directory()const{ | 650 | QString OFileViewFileSystem::directory()const{ |
631 | if (!m_view) | 651 | if (!m_view) |
632 | return QString::null; | 652 | return QString::null; |
633 | 653 | ||
634 | OFileSelectorItem* item = m_view->currentItem(); | 654 | OFileSelectorItem* item = m_view->currentItem(); |
635 | if (!item ) | 655 | if (!item ) |
636 | return QString::null; | 656 | return QString::null; |
637 | 657 | ||
638 | return QDir(item->directory() ).absPath(); | 658 | return QDir(item->directory() ).absPath(); |
639 | } | 659 | } |
640 | void OFileViewFileSystem::reread() { | 660 | void OFileViewFileSystem::reread() { |
641 | if (!m_view) | 661 | if (!m_view) |
642 | return; | 662 | return; |
643 | 663 | ||
644 | m_view->reread( m_all ); | 664 | m_view->reread( m_all ); |
645 | } | 665 | } |
646 | int OFileViewFileSystem::fileCount()const{ | 666 | int OFileViewFileSystem::fileCount()const{ |
647 | if (!m_view ) | 667 | if (!m_view ) |
648 | return -1; | 668 | return -1; |
649 | return m_view->fileCount(); | 669 | return m_view->fileCount(); |
650 | } | 670 | } |
651 | QWidget* OFileViewFileSystem::widget( QWidget* parent ) { | 671 | QWidget* OFileViewFileSystem::widget( QWidget* parent ) { |
652 | if (!m_view ) { | 672 | if (!m_view ) { |
653 | m_view = new OFileViewFileListView( parent, startDirectory(), selector() ); | 673 | m_view = new OFileViewFileListView( parent, startDirectory(), selector() ); |
654 | } | 674 | } |
655 | return m_view; | 675 | return m_view; |
656 | } | 676 | } |
657 | void OFileViewFileSystem::activate( const QString& str) { | 677 | void OFileViewFileSystem::activate( const QString& str) { |
658 | m_all = (str !=i18n("Files") ); | 678 | m_all = (str !=i18n("Files") ); |
659 | 679 | ||
660 | 680 | ||
661 | } | 681 | } |
662 | 682 | ||
663 | /* Selector */ | 683 | /* Selector */ |
664 | OFileSelector::OFileSelector( QWidget* parent, int mode, int sel, | 684 | OFileSelector::OFileSelector( QWidget* parent, int mode, int sel, |
665 | const QString& dirName, const QString& fileName, | 685 | const QString& dirName, const QString& fileName, |
666 | const MimeTypes& mimetypes, | 686 | const MimeTypes& mimetypes, |
667 | bool showNew, bool showClose) | 687 | bool showNew, bool showClose) |
668 | : QWidget( parent, "OFileSelector" ) | 688 | : QWidget( parent, "OFileSelector" ) |
669 | { | 689 | { |
670 | m_current = 0; | 690 | m_current = 0; |
671 | m_shNew = showNew; | 691 | m_shNew = showNew; |
672 | m_shClose = showClose; | 692 | m_shClose = showClose; |
673 | m_mimeType = mimetypes; | 693 | m_mimeType = mimetypes; |
674 | m_startDir = dirName; | 694 | m_startDir = dirName; |
675 | m_mode = mode; | 695 | m_mode = mode; |
676 | m_selector = sel; | 696 | m_selector = sel; |
677 | 697 | ||
678 | initUI(); | 698 | initUI(); |
679 | m_lneEdit->setText( fileName ); | 699 | m_lneEdit->setText( fileName ); |
680 | initMime(); | 700 | initMime(); |
681 | initViews(); | 701 | initViews(); |
682 | 702 | ||
683 | QString str; | 703 | QString str; |
684 | switch ( m_selector ) { | 704 | switch ( m_selector ) { |
685 | default: | 705 | default: |
686 | case Normal: | 706 | case Normal: |
687 | str = i18n("Documents"); | 707 | str = i18n("Documents"); |
688 | m_cmbView->setCurrentItem( 0 ); | 708 | m_cmbView->setCurrentItem( 0 ); |
689 | break; | 709 | break; |
690 | case Extended: | 710 | case Extended: |
691 | str = i18n("Files"); | 711 | str = i18n("Files"); |
692 | m_cmbView->setCurrentItem( 1 ); | 712 | m_cmbView->setCurrentItem( 1 ); |
693 | break; | 713 | break; |
694 | case ExtendedAll: | 714 | case ExtendedAll: |
695 | str = i18n("All Files"); | 715 | str = i18n("All Files"); |
696 | m_cmbView->setCurrentItem( 2 ); | 716 | m_cmbView->setCurrentItem( 2 ); |
697 | break; | 717 | break; |
698 | } | 718 | } |
699 | slotViewChange( str ); | 719 | slotViewChange( str ); |
700 | 720 | ||
701 | } | 721 | } |
702 | OFileSelector::OFileSelector( const QString& mimeFilter, QWidget* parent, const char* name, | 722 | OFileSelector::OFileSelector( const QString& mimeFilter, QWidget* parent, const char* name, |
703 | bool showNew, bool showClose ) | 723 | bool showNew, bool showClose ) |
704 | : QWidget( parent, name ) | 724 | : QWidget( parent, name ) |
705 | { | 725 | { |
706 | m_current = 0; | 726 | m_current = 0; |
707 | m_shNew = showNew; | 727 | m_shNew = showNew; |
708 | m_shClose = showClose; | 728 | m_shClose = showClose; |
709 | m_startDir = QPEApplication::documentDir(); | 729 | m_startDir = QPEApplication::documentDir(); |
710 | 730 | ||
711 | if (!mimeFilter.isEmpty() ) | 731 | if (!mimeFilter.isEmpty() ) |
712 | m_mimeType.insert(mimeFilter, QStringList::split(";", mimeFilter ) ); | 732 | m_mimeType.insert(mimeFilter, QStringList::split(";", mimeFilter ) ); |
713 | 733 | ||
714 | m_mode = OFileSelector::FileSelector; | 734 | m_mode = OFileSelector::FileSelector; |
715 | m_selector = OFileSelector::Normal; | 735 | m_selector = OFileSelector::Normal; |
716 | 736 | ||
717 | initUI(); | 737 | initUI(); |
718 | initMime(); | 738 | initMime(); |
719 | initViews(); | 739 | initViews(); |
720 | m_cmbView->setCurrentItem( 0 ); | 740 | m_cmbView->setCurrentItem( 0 ); |
721 | slotViewChange( i18n("Documents") ); | 741 | slotViewChange( i18n("Documents") ); |
722 | } | 742 | } |
723 | /* | 743 | /* |
724 | * INIT UI will set up the basic GUI | 744 | * INIT UI will set up the basic GUI |
725 | * Layout: Simple VBoxLayout | 745 | * Layout: Simple VBoxLayout |
726 | * On top a WidgetStack containing the Views... | 746 | * On top a WidgetStack containing the Views... |
727 | * - List View | 747 | * - List View |
728 | * - Document View | 748 | * - Document View |
729 | * Below we will have a Label + LineEdit | 749 | * Below we will have a Label + LineEdit |
730 | * Below we will have two ComoBoxes one for choosing the view one for | 750 | * Below we will have two ComoBoxes one for choosing the view one for |
731 | * choosing the mimetype | 751 | * choosing the mimetype |
732 | */ | 752 | */ |
733 | void OFileSelector::initUI() { | 753 | void OFileSelector::initUI() { |
734 | QVBoxLayout* lay = new QVBoxLayout( this ); | 754 | QVBoxLayout* lay = new QVBoxLayout( this ); |
735 | 755 | ||
736 | m_stack = new QWidgetStack( this ); | 756 | m_stack = new QWidgetStack( this ); |
737 | lay->addWidget( m_stack, 1000 ); | 757 | lay->addWidget( m_stack, 1000 ); |
738 | 758 | ||
739 | m_nameBox = new QHBox( this ); | 759 | m_nameBox = new QHBox( this ); |
740 | (void)new QLabel( i18n("Name:"), m_nameBox ); | 760 | (void)new QLabel( i18n("Name:"), m_nameBox ); |
741 | m_lneEdit = new QLineEdit( m_nameBox ); | 761 | m_lneEdit = new QLineEdit( m_nameBox ); |
742 | m_lneEdit ->installEventFilter(this); | 762 | m_lneEdit ->installEventFilter(this); |
743 | lay->addWidget( m_nameBox ); | 763 | lay->addWidget( m_nameBox ); |
744 | 764 | ||
745 | m_cmbBox = new QHBox( this ); | 765 | m_cmbBox = new QHBox( this ); |
746 | m_cmbView = new QComboBox( m_cmbBox ); | 766 | m_cmbView = new QComboBox( m_cmbBox ); |
747 | m_cmbMime = new QComboBox( m_cmbBox ); | 767 | m_cmbMime = new QComboBox( m_cmbBox ); |
748 | lay->addWidget( m_cmbBox ); | 768 | lay->addWidget( m_cmbBox ); |
749 | } | 769 | } |
750 | 770 | ||
751 | /* | 771 | /* |
752 | * This will make sure that the return key in the name edit causes dialogs to close | 772 | * This will make sure that the return key in the name edit causes dialogs to close |
753 | */ | 773 | */ |
754 | 774 | ||
755 | bool OFileSelector::eventFilter (QObject *o, QEvent *e) { | 775 | bool OFileSelector::eventFilter (QObject *o, QEvent *e) { |
756 | if ( e->type() == QEvent::KeyPress ) { | 776 | if ( e->type() == QEvent::KeyPress ) { |
757 | QKeyEvent *k = (QKeyEvent *)e; | 777 | QKeyEvent *k = (QKeyEvent *)e; |
758 | if ( (k->key()==Key_Enter) || (k->key()==Key_Return)) { | 778 | if ( (k->key()==Key_Enter) || (k->key()==Key_Return)) { |
759 | emit ok(); | 779 | emit ok(); |
760 | return true; | 780 | return true; |
761 | } | 781 | } |
762 | } | 782 | } |
763 | return false; | 783 | return false; |
764 | } | 784 | } |
765 | 785 | ||
766 | /* | 786 | /* |
767 | * This will insert the MimeTypes into the Combo Box | 787 | * This will insert the MimeTypes into the Combo Box |
768 | * And also connect the changed signal | 788 | * And also connect the changed signal |
769 | * | 789 | * |
770 | * AutoMimeTyping is disabled for now. It used to reparse a dir and then set available mimetypes | 790 | * AutoMimeTyping is disabled for now. It used to reparse a dir and then set available mimetypes |
771 | */ | 791 | */ |