Diffstat (limited to 'libopie2/opieui/fileselector/ofileselector.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opieui/fileselector/ofileselector.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/libopie2/opieui/fileselector/ofileselector.cpp b/libopie2/opieui/fileselector/ofileselector.cpp index 600daff..15cadd4 100644 --- a/libopie2/opieui/fileselector/ofileselector.cpp +++ b/libopie2/opieui/fileselector/ofileselector.cpp | |||
@@ -189,54 +189,54 @@ void ODocumentFileView::reread() | |||
189 | m_selector->reread(); | 189 | m_selector->reread(); |
190 | } | 190 | } |
191 | 191 | ||
192 | int ODocumentFileView::fileCount()const | 192 | int ODocumentFileView::fileCount()const |
193 | { | 193 | { |
194 | if (!m_selector) | 194 | if (!m_selector) |
195 | return -1; | 195 | return -1; |
196 | 196 | ||
197 | return m_selector->fileCount(); | 197 | return m_selector->fileCount(); |
198 | } | 198 | } |
199 | 199 | ||
200 | DocLnk ODocumentFileView::selectedDocument()const | 200 | DocLnk ODocumentFileView::selectedDocument()const |
201 | { | 201 | { |
202 | if (!m_selector) | 202 | if (!m_selector) |
203 | return DocLnk(); | 203 | return DocLnk(); |
204 | 204 | ||
205 | return m_selector->selectedDocument(); | 205 | return m_selector->selectedDocument(); |
206 | } | 206 | } |
207 | 207 | ||
208 | QWidget* ODocumentFileView::widget( QWidget* parent ) | 208 | QWidget* ODocumentFileView::widget( QWidget* parent ) |
209 | { | 209 | { |
210 | if (!m_selector ) | 210 | if (!m_selector ) |
211 | { | 211 | { |
212 | m_selector = new FileSelector(currentMimeType().join(";"), parent, "fileselector", showNew(), showClose() ); | 212 | m_selector = new FileSelector(currentMimeType().join(";"), parent, "fileselector", showNew(), showClose() ); |
213 | QObject::connect(m_selector, SIGNAL(fileSelected( const DocLnk& ) ), | 213 | QObject::connect(m_selector, SIGNAL(fileSelected(const DocLnk&) ), |
214 | selector(), SLOT(slotDocLnkBridge(const DocLnk&) ) ); | 214 | selector(), SLOT(slotDocLnkBridge(const DocLnk&) ) ); |
215 | QObject::connect(m_selector, SIGNAL(closeMe() ), | 215 | QObject::connect(m_selector, SIGNAL(closeMe() ), |
216 | selector(), SIGNAL(closeMe() ) ); | 216 | selector(), SIGNAL(closeMe() ) ); |
217 | QObject::connect(m_selector, SIGNAL(newSelected(const DocLnk& ) ), | 217 | QObject::connect(m_selector, SIGNAL(newSelected(const DocLnk&) ), |
218 | selector(), SIGNAL(newSelected(const DocLnk& ) ) ); | 218 | selector(), SIGNAL(newSelected(const DocLnk&) ) ); |
219 | } | 219 | } |
220 | 220 | ||
221 | return m_selector; | 221 | return m_selector; |
222 | } | 222 | } |
223 | 223 | ||
224 | /* | 224 | /* |
225 | * This is the file system view used | 225 | * This is the file system view used |
226 | * we use a QListView + QListViewItems for it | 226 | * we use a QListView + QListViewItems for it |
227 | */ | 227 | */ |
228 | 228 | ||
229 | OFileSelectorItem::OFileSelectorItem( QListView* view, const QPixmap& pixmap, | 229 | OFileSelectorItem::OFileSelectorItem( QListView* view, const QPixmap& pixmap, |
230 | const QString& path, const QString& date, | 230 | const QString& path, const QString& date, |
231 | const QString& size, const QString& dir, | 231 | const QString& size, const QString& dir, |
232 | bool isLocked, bool isDir ) | 232 | bool isLocked, bool isDir ) |
233 | : QListViewItem( view ) | 233 | : QListViewItem( view ) |
234 | { | 234 | { |
235 | setPixmap(0, pixmap ); | 235 | setPixmap(0, pixmap ); |
236 | setText(1, path ); | 236 | setText(1, path ); |
237 | setText(2, size ); | 237 | setText(2, size ); |
238 | setText(3, date ); | 238 | setText(3, date ); |
239 | m_isDir = isDir; | 239 | m_isDir = isDir; |
240 | m_dir = dir; | 240 | m_dir = dir; |
241 | m_locked = isLocked; | 241 | m_locked = isLocked; |
242 | } | 242 | } |
@@ -503,50 +503,50 @@ QString OFileViewFileListView::currentDir()const | |||
503 | 503 | ||
504 | OFileSelector* OFileViewFileListView::selector() | 504 | OFileSelector* OFileViewFileListView::selector() |
505 | { | 505 | { |
506 | return m_sel; | 506 | return m_sel; |
507 | } | 507 | } |
508 | 508 | ||
509 | bool OFileViewFileListView::eventFilter (QObject *o, QEvent *e) | 509 | bool OFileViewFileListView::eventFilter (QObject *o, QEvent *e) |
510 | { | 510 | { |
511 | if ( e->type() == QEvent::KeyPress ) | 511 | if ( e->type() == QEvent::KeyPress ) |
512 | { | 512 | { |
513 | QKeyEvent *k = (QKeyEvent *)e; | 513 | QKeyEvent *k = (QKeyEvent *)e; |
514 | if ( (k->key()==Key_Enter) || (k->key()==Key_Return)) | 514 | if ( (k->key()==Key_Enter) || (k->key()==Key_Return)) |
515 | { | 515 | { |
516 | slotClicked( Qt::LeftButton,m_view->currentItem(),QPoint(0,0),0); | 516 | slotClicked( Qt::LeftButton,m_view->currentItem(),QPoint(0,0),0); |
517 | return true; | 517 | return true; |
518 | } | 518 | } |
519 | } | 519 | } |
520 | return false; | 520 | return false; |
521 | } | 521 | } |
522 | 522 | ||
523 | void OFileViewFileListView::connectSlots() | 523 | void OFileViewFileListView::connectSlots() |
524 | { | 524 | { |
525 | connect(m_view, SIGNAL(clicked(QListViewItem*) ), | 525 | connect(m_view, SIGNAL(clicked(QListViewItem*) ), |
526 | this, SLOT(slotCurrentChanged(QListViewItem*) ) ); | 526 | this, SLOT(slotCurrentChanged(QListViewItem*) ) ); |
527 | connect(m_view, SIGNAL(mouseButtonClicked(int, QListViewItem*, const QPoint&, int ) ), | 527 | connect(m_view, SIGNAL(mouseButtonClicked(int,QListViewItem*,const QPoint&,int) ), |
528 | this, SLOT(slotClicked(int, QListViewItem*, const QPoint&, int ) ) ); | 528 | this, SLOT(slotClicked(int,QListViewItem*,const QPoint&,int) ) ); |
529 | } | 529 | } |
530 | 530 | ||
531 | void OFileViewFileListView::slotCurrentChanged( QListViewItem* item) | 531 | void OFileViewFileListView::slotCurrentChanged( QListViewItem* item) |
532 | { | 532 | { |
533 | if (!item) | 533 | if (!item) |
534 | return; | 534 | return; |
535 | #if 0 | 535 | #if 0 |
536 | 536 | ||
537 | OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item); | 537 | OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item); |
538 | 538 | ||
539 | if (!sel->isDir() ) | 539 | if (!sel->isDir() ) |
540 | { | 540 | { |
541 | selector()->m_lneEdit->setText( sel->text(1) ); | 541 | selector()->m_lneEdit->setText( sel->text(1) ); |
542 | // if in fileselector mode we will emit selected | 542 | // if in fileselector mode we will emit selected |
543 | if ( selector()->mode() == OFileSelector::FileSelector ) | 543 | if ( selector()->mode() == OFileSelector::FileSelector ) |
544 | { | 544 | { |
545 | qWarning("slot Current Changed"); | 545 | qWarning("slot Current Changed"); |
546 | QStringList str = QStringList::split("->", sel->text(1) ); | 546 | QStringList str = QStringList::split("->", sel->text(1) ); |
547 | QString path = sel->directory() + "/" + str[0].stripWhiteSpace(); | 547 | QString path = sel->directory() + "/" + str[0].stripWhiteSpace(); |
548 | emit selector()->fileSelected( path ); | 548 | emit selector()->fileSelected( path ); |
549 | DocLnk lnk( path ); | 549 | DocLnk lnk( path ); |
550 | emit selector()->fileSelected( lnk ); | 550 | emit selector()->fileSelected( lnk ); |
551 | } | 551 | } |
552 | } | 552 | } |
@@ -958,50 +958,50 @@ bool OFileSelector::eventFilter (QObject *o, QEvent *e) | |||
958 | * This will insert the MimeTypes into the Combo Box | 958 | * This will insert the MimeTypes into the Combo Box |
959 | * And also connect the changed signal | 959 | * And also connect the changed signal |
960 | * | 960 | * |
961 | * AutoMimeTyping is disabled for now. It used to reparse a dir and then set available mimetypes | 961 | * AutoMimeTyping is disabled for now. It used to reparse a dir and then set available mimetypes |
962 | */ | 962 | */ |
963 | void OFileSelector::initMime() | 963 | void OFileSelector::initMime() |
964 | { | 964 | { |
965 | MimeTypes::Iterator it; | 965 | MimeTypes::Iterator it; |
966 | for ( it = m_mimeType.begin(); it != m_mimeType.end(); ++it ) | 966 | for ( it = m_mimeType.begin(); it != m_mimeType.end(); ++it ) |
967 | { | 967 | { |
968 | m_cmbMime->insertItem( it.key() ); | 968 | m_cmbMime->insertItem( it.key() ); |
969 | } | 969 | } |
970 | m_cmbMime->setCurrentItem( 0 ); | 970 | m_cmbMime->setCurrentItem( 0 ); |
971 | 971 | ||
972 | connect( m_cmbMime, SIGNAL(activated(int) ), | 972 | connect( m_cmbMime, SIGNAL(activated(int) ), |
973 | this, SLOT(slotMimeTypeChanged() ) ); | 973 | this, SLOT(slotMimeTypeChanged() ) ); |
974 | 974 | ||
975 | } | 975 | } |
976 | 976 | ||
977 | void OFileSelector::initViews() | 977 | void OFileSelector::initViews() |
978 | { | 978 | { |
979 | m_cmbView->insertItem( QObject::tr("Documents") ); | 979 | m_cmbView->insertItem( QObject::tr("Documents") ); |
980 | m_cmbView->insertItem( QObject::tr("Files") ); | 980 | m_cmbView->insertItem( QObject::tr("Files") ); |
981 | m_cmbView->insertItem( QObject::tr("All Files") ); | 981 | m_cmbView->insertItem( QObject::tr("All Files") ); |
982 | connect(m_cmbView, SIGNAL(activated( const QString& ) ), | 982 | connect(m_cmbView, SIGNAL(activated(const QString&) ), |
983 | this, SLOT(slotViewChange( const QString& ) ) ); | 983 | this, SLOT(slotViewChange(const QString&) ) ); |
984 | 984 | ||
985 | 985 | ||
986 | m_views.insert( QObject::tr("Documents"), new ODocumentFileView(this) ); | 986 | m_views.insert( QObject::tr("Documents"), new ODocumentFileView(this) ); |
987 | 987 | ||
988 | /* see above why add both */ | 988 | /* see above why add both */ |
989 | OFileViewInterface* in = new OFileViewFileSystem( this ); | 989 | OFileViewInterface* in = new OFileViewFileSystem( this ); |
990 | m_views.insert( QObject::tr("Files"), in ); | 990 | m_views.insert( QObject::tr("Files"), in ); |
991 | m_views.insert( QObject::tr("All Files"), in ); | 991 | m_views.insert( QObject::tr("All Files"), in ); |
992 | } | 992 | } |
993 | 993 | ||
994 | /** | 994 | /** |
995 | * d'tor | 995 | * d'tor |
996 | */ | 996 | */ |
997 | OFileSelector::~OFileSelector() | 997 | OFileSelector::~OFileSelector() |
998 | { | 998 | { |
999 | } | 999 | } |
1000 | 1000 | ||
1001 | 1001 | ||
1002 | 1002 | ||
1003 | /** | 1003 | /** |
1004 | * Convience function for the fileselector | 1004 | * Convience function for the fileselector |
1005 | * make sure to delete the DocLnk | 1005 | * make sure to delete the DocLnk |
1006 | * | 1006 | * |
1007 | * @see DocLnk | 1007 | * @see DocLnk |