author | mickeyl <mickeyl> | 2005-07-03 21:12:58 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2005-07-03 21:12:58 (UTC) |
commit | 47011752d4457a1055894479e5bf855e100fddac (patch) (unidiff) | |
tree | d986b103f0023b990c02c208fc527d90f7c79ce3 | |
parent | 27bee477e2689d9b37d2d4cabce05c8d55295ebd (diff) | |
download | opie-47011752d4457a1055894479e5bf855e100fddac.zip opie-47011752d4457a1055894479e5bf855e100fddac.tar.gz opie-47011752d4457a1055894479e5bf855e100fddac.tar.bz2 |
remove hard coded scaling of 'UnknownDocument' icon (and restore header, btw.)
-rw-r--r-- | libopie2/opieui/fileselector/ofiledialog.cpp | 4 | ||||
-rw-r--r-- | libopie2/opieui/fileselector/ofileselector.cpp | 56 |
2 files changed, 26 insertions, 34 deletions
diff --git a/libopie2/opieui/fileselector/ofiledialog.cpp b/libopie2/opieui/fileselector/ofiledialog.cpp index 2d38961..11a9e33 100644 --- a/libopie2/opieui/fileselector/ofiledialog.cpp +++ b/libopie2/opieui/fileselector/ofiledialog.cpp | |||
@@ -1,58 +1,58 @@ | |||
1 | /* | 1 | /* |
2 | =. This file is part of the OPIE Project | 2 | =. This file is part of the OPIE Project |
3 | .=l. Copyright (C) Holger Freyther <freyther@handhelds.org> | 3 | .=l. Copyright (C) Holger Freyther <freyther@handhelds.org> |
4 | .>+-= | 4 | .>+-= |
5 | _;:, .> :=|. This library is free software; you can | 5 | _;:, .> :=|. This library is free software; you can |
6 | .> <`_, > . <= redistribute it and/or modify it under | 6 | .> <`_, > . <= redistribute it and/or modify it under |
7 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 7 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
8 | .="- .-=="i, .._ License as published by the Free Software | 8 | .="- .-=="i, .._ License as published by the Free Software |
9 | - . .-<_> .<> Foundation; either version 2 of the License, | 9 | - . .-<_> .<> Foundation; version 2 of the License. |
10 | ._= =} : or (at your option) any later version. | 10 | ._= =} : |
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 | 29 | ||
30 | /* OPIE */ | 30 | /* OPIE */ |
31 | #include <opie2/ofiledialog.h> | 31 | #include <opie2/ofiledialog.h> |
32 | #include <qpe/applnk.h> | 32 | #include <qpe/applnk.h> |
33 | #include <qpe/config.h> | 33 | #include <qpe/config.h> |
34 | #include <qpe/qpeapplication.h> | 34 | #include <qpe/qpeapplication.h> |
35 | 35 | ||
36 | /* QT */ | 36 | /* QT */ |
37 | #include <qfileinfo.h> | 37 | #include <qfileinfo.h> |
38 | #include <qstring.h> | 38 | #include <qstring.h> |
39 | #include <qapplication.h> | 39 | #include <qapplication.h> |
40 | #include <qlayout.h> | 40 | #include <qlayout.h> |
41 | 41 | ||
42 | 42 | ||
43 | /* TRANSLATOR Opie::Ui::OFileDialog */ | 43 | /* TRANSLATOR Opie::Ui::OFileDialog */ |
44 | 44 | ||
45 | using namespace Opie::Ui; | 45 | using namespace Opie::Ui; |
46 | 46 | ||
47 | namespace | 47 | namespace |
48 | { | 48 | { |
49 | /* | 49 | /* |
50 | * helper functions to load the start dir | 50 | * helper functions to load the start dir |
51 | * and to save it | 51 | * and to save it |
52 | * helper to extract the dir out of a file name | 52 | * helper to extract the dir out of a file name |
53 | */ | 53 | */ |
54 | /** | 54 | /** |
55 | * This method will use Config( argv[0] ); | 55 | * This method will use Config( argv[0] ); |
56 | * @param key The group key used | 56 | * @param key The group key used |
57 | */ | 57 | */ |
58 | QString lastUsedDir( const QString& key ) | 58 | QString lastUsedDir( const QString& key ) |
diff --git a/libopie2/opieui/fileselector/ofileselector.cpp b/libopie2/opieui/fileselector/ofileselector.cpp index 02404e5..5b5dc2f 100644 --- a/libopie2/opieui/fileselector/ofileselector.cpp +++ b/libopie2/opieui/fileselector/ofileselector.cpp | |||
@@ -1,76 +1,74 @@ | |||
1 | /* | 1 | /* |
2 | Â Â Â Â Â Â Â Â This file is part of the Opie Project | 2 | =. This file is part of the OPIE Project |
3 | 3 | .=l. Copyright (C) Holger Freyther <freyther@handhelds.org> | |
4 | Copyright (C) 2002,2003 Holger Freyther <zecke@handhelds.org> | 4 | .>+-= |
5 | =. | 5 | _;:, .> :=|. This library is free software; you can |
6 | .=l. | 6 | .> <`_, > . <= redistribute it and/or modify it under |
7 | Â Â Â Â Â Â .>+-= | 7 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
8 | Â _;:, Â Â .> Â Â :=|. This program is free software; you can | 8 | .="- .-=="i, .._ License as published by the Free Software |
9 | .> <`_, Â > Â . Â <= redistribute it and/or modify it under | 9 | - . .-<_> .<> Foundation; version 2 of the License. |
10 | :`=1 )Y*s>-.-- Â : the terms of the GNU Library General Public | 10 | ._= =} : |
11 | .="- .-=="i, Â Â .._ License as published by the Free Software | 11 | .%`+i> _;_. |
12 | Â - . Â .-<_> Â Â .<> Foundation; either version 2 of the License, | 12 | .i_,=:_. -<s. This library is distributed in the hope that |
13 | Â Â Â ._= =} Â Â Â : or (at your option) any later version. | 13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
14 | Â Â .%`+i> Â Â Â _;_. | 14 | : .. .:, . . . without even the implied warranty of |
15 | Â Â .i_,=:_. Â Â Â -<s. This program is distributed in the hope that | 15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
16 | Â Â Â + Â . Â -:. Â Â Â = it will be useful, but WITHOUT ANY WARRANTY; | 16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
17 | : .. Â Â .:, Â Â . . . without even the implied warranty of | 17 | ..}^=.= = ; Library General Public License for more |
18 | Â Â =_ Â Â Â Â + Â Â =;=|` MERCHANTABILITY or FITNESS FOR A | 18 | ++= -. .` .: details. |
19 | Â _.=:. Â Â Â : Â Â :=>`: PARTICULAR PURPOSE. See the GNU | 19 | : = ...= . :.=- |
20 | ..}^=.= Â Â Â = Â Â Â ; Library General Public License for more | 20 | -. .:....=;==+<; You should have received a copy of the GNU |
21 | ++= Â -. Â Â .` Â Â .: details. | 21 | -_. . . )=. = Library General Public License along with |
22 | : Â Â = Â ...= . :.=- | 22 | -- :-=` this library; see the file COPYING.LIB. |
23 | Â -. Â .:....=;==+<; You should have received a copy of the GNU | ||
24 | Â -_. . . Â )=. Â = Library General Public License along with | ||
25 | Â Â -- Â Â Â Â :-=` this library; see the file COPYING.LIB. | ||
26 | If not, write to the Free Software Foundation, | 23 | If not, write to the Free Software Foundation, |
27 | Inc., 59 Temple Place - Suite 330, | 24 | Inc., 59 Temple Place - Suite 330, |
28 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | |||
29 | */ | 27 | */ |
30 | 28 | ||
31 | /* hacky but we need to get FileSelector::filter */ | 29 | /* hacky but we need to get FileSelector::filter */ |
32 | #define private public | 30 | #define private public |
33 | #include <qpe/fileselector.h> | 31 | #include <qpe/fileselector.h> |
34 | #undef private | 32 | #undef private |
35 | 33 | ||
36 | #include "ofileselector_p.h" | 34 | #include "ofileselector_p.h" |
37 | 35 | ||
38 | /* OPIE */ | 36 | /* OPIE */ |
39 | #include <opie2/odebug.h> | 37 | #include <opie2/odebug.h> |
40 | #include <opie2/ofileselector.h> | 38 | #include <opie2/ofileselector.h> |
41 | #include <opie2/oresource.h> | 39 | #include <opie2/oresource.h> |
42 | 40 | ||
43 | #include <qpe/qpeapplication.h> | 41 | #include <qpe/qpeapplication.h> |
44 | #include <qpe/mimetype.h> | 42 | #include <qpe/mimetype.h> |
45 | #include <qpe/storage.h> | 43 | #include <qpe/storage.h> |
46 | 44 | ||
47 | /* QT */ | 45 | /* QT */ |
48 | #include <qcombobox.h> | 46 | #include <qcombobox.h> |
49 | #include <qdir.h> | 47 | #include <qdir.h> |
50 | #include <qhbox.h> | 48 | #include <qhbox.h> |
51 | #include <qheader.h> | 49 | #include <qheader.h> |
52 | #include <qlabel.h> | 50 | #include <qlabel.h> |
53 | #include <qlayout.h> | 51 | #include <qlayout.h> |
54 | #include <qlineedit.h> | 52 | #include <qlineedit.h> |
55 | #include <qlistview.h> | 53 | #include <qlistview.h> |
56 | #include <qpopupmenu.h> | 54 | #include <qpopupmenu.h> |
57 | #include <qwidgetstack.h> | 55 | #include <qwidgetstack.h> |
58 | #include <qregexp.h> | 56 | #include <qregexp.h> |
59 | #include <qobjectlist.h> | 57 | #include <qobjectlist.h> |
60 | 58 | ||
61 | using namespace Opie::Ui::Internal; | 59 | using namespace Opie::Ui::Internal; |
62 | 60 | ||
63 | namespace Opie { | 61 | namespace Opie { |
64 | namespace Ui { | 62 | namespace Ui { |
65 | namespace Internal { | 63 | namespace Internal { |
66 | /* | 64 | /* |
67 | * Create a path by adding a '/'/QDir::seperator in between | 65 | * Create a path by adding a '/'/QDir::seperator in between |
68 | * base and ending, but only if base is not empty | 66 | * base and ending, but only if base is not empty |
69 | */ | 67 | */ |
70 | static inline QString createNewPath(const QString& base, const QString &ending) { | 68 | static inline QString createNewPath(const QString& base, const QString &ending) { |
71 | return base == QString::fromLatin1("/") ? | 69 | return base == QString::fromLatin1("/") ? |
72 | base + ending : base + "/" + ending; | 70 | base + ending : base + "/" + ending; |
73 | } | 71 | } |
74 | 72 | ||
75 | 73 | ||
76 | OFileViewInterface::OFileViewInterface( OFileSelector* _selector ) | 74 | OFileViewInterface::OFileViewInterface( OFileSelector* _selector ) |
@@ -586,115 +584,109 @@ void OFileViewFileListView::slotCurrentChanged( QListViewItem* item) | |||
586 | if ( selector()->mode() == OFileSelector::FileSelector ) | 584 | if ( selector()->mode() == OFileSelector::FileSelector ) |
587 | { | 585 | { |
588 | odebug << "slot Current Changed" << oendl; | 586 | odebug << "slot Current Changed" << oendl; |
589 | QStringList str = QStringList::split("->", sel->text(1) ); | 587 | QStringList str = QStringList::split("->", sel->text(1) ); |
590 | QString path = createNewPath(sel->directory(),str[0].stripWhiteSpace()); | 588 | QString path = createNewPath(sel->directory(),str[0].stripWhiteSpace()); |
591 | emit selector()->fileSelected( path ); | 589 | emit selector()->fileSelected( path ); |
592 | DocLnk lnk( path ); | 590 | DocLnk lnk( path ); |
593 | emit selector()->fileSelected( lnk ); | 591 | emit selector()->fileSelected( lnk ); |
594 | } | 592 | } |
595 | } | 593 | } |
596 | #endif | 594 | #endif |
597 | } | 595 | } |
598 | 596 | ||
599 | void OFileViewFileListView::slotClicked(int button , QListViewItem* item, const QPoint&, int ) | 597 | void OFileViewFileListView::slotClicked(int button , QListViewItem* item, const QPoint&, int ) |
600 | { | 598 | { |
601 | if (!item || ( button != Qt::LeftButton) ) | 599 | if (!item || ( button != Qt::LeftButton) ) |
602 | return; | 600 | return; |
603 | 601 | ||
604 | OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item); | 602 | OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item); |
605 | if (!sel->isLocked() ) | 603 | if (!sel->isLocked() ) |
606 | { | 604 | { |
607 | QStringList str = QStringList::split("->", sel->text(1) ); | 605 | QStringList str = QStringList::split("->", sel->text(1) ); |
608 | if (sel->isDir() ) | 606 | if (sel->isDir() ) |
609 | { | 607 | { |
610 | m_currentDir = createNewPath(sel->directory(),str[0].stripWhiteSpace()); | 608 | m_currentDir = createNewPath(sel->directory(),str[0].stripWhiteSpace()); |
611 | emit selector()->dirSelected( m_currentDir ); | 609 | emit selector()->dirSelected( m_currentDir ); |
612 | reread( m_all ); | 610 | reread( m_all ); |
613 | } | 611 | } |
614 | else | 612 | else |
615 | { // file | 613 | { // file |
616 | odebug << "slot Clicked" << oendl; | 614 | odebug << "slot Clicked" << oendl; |
617 | selector()->m_lneEdit->setText( str[0].stripWhiteSpace() ); | 615 | selector()->m_lneEdit->setText( str[0].stripWhiteSpace() ); |
618 | QString path = createNewPath(sel->directory(),str[0].stripWhiteSpace()); | 616 | QString path = createNewPath(sel->directory(),str[0].stripWhiteSpace()); |
619 | emit selector()->fileSelected( path ); | 617 | emit selector()->fileSelected( path ); |
620 | DocLnk lnk( path ); | 618 | DocLnk lnk( path ); |
621 | emit selector()->fileSelected( lnk ); | 619 | emit selector()->fileSelected( lnk ); |
622 | } | 620 | } |
623 | } // not locked | 621 | } // not locked |
624 | } | 622 | } |
625 | 623 | ||
626 | void OFileViewFileListView::addFile( QFileInfo* info, bool symlink ) | 624 | void OFileViewFileListView::addFile( QFileInfo* info, bool symlink ) |
627 | { | 625 | { |
628 | MimeType type( info->absFilePath() ); | 626 | MimeType type( info->absFilePath() ); |
629 | if (!compliesMime( type.id() ) ) | 627 | if (!compliesMime( type.id() ) ) |
630 | return; | 628 | return; |
631 | 629 | ||
632 | QPixmap pix = type.pixmap(); | 630 | QPixmap pix = type.pixmap(); |
633 | QString dir, name; bool locked; | 631 | QString dir, name; bool locked; |
634 | if ( pix.isNull() ) | 632 | if ( pix.isNull() ) pix = Opie::Core::OResource::loadPixmap( "UnknownDocument", Opie::Core::OResource::SmallIcon ); |
635 | { | ||
636 | QWMatrix matrix; | ||
637 | QPixmap pixer( Opie::Core::OResource::loadPixmap( "UnknownDocument" ) ); | ||
638 | matrix.scale( .4, .4 ); | ||
639 | pix = pixer.xForm( matrix ); | ||
640 | } | ||
641 | dir = info->dirPath( true ); | 633 | dir = info->dirPath( true ); |
642 | locked = false; | 634 | locked = false; |
643 | if ( symlink ) | 635 | if ( symlink ) |
644 | name = info->fileName() + " -> " + createNewPath(info->dirPath(),info->readLink()); | 636 | name = info->fileName() + " -> " + createNewPath(info->dirPath(),info->readLink()); |
645 | else | 637 | else |
646 | { | 638 | { |
647 | name = info->fileName(); | 639 | name = info->fileName(); |
648 | if ( ( (selector()->mode() == OFileSelector::Open)&& !info->isReadable() ) || | 640 | if ( ( (selector()->mode() == OFileSelector::Open)&& !info->isReadable() ) || |
649 | ( (selector()->mode() == OFileSelector::Save)&& !info->isWritable() ) ) | 641 | ( (selector()->mode() == OFileSelector::Save)&& !info->isWritable() ) ) |
650 | { | 642 | { |
651 | locked = true; | 643 | locked = true; |
652 | pix = Opie::Core::OResource::loadPixmap( "locked" ); | 644 | pix = Opie::Core::OResource::loadPixmap( "locked", Opie::Core::OResource::SmallIcon ); |
653 | } | 645 | } |
654 | } | 646 | } |
655 | (void)new OFileSelectorItem( m_view, pix, name, | 647 | (void)new OFileSelectorItem( m_view, pix, name, |
656 | info->lastModified().toString(), QString::number( info->size() ), | 648 | info->lastModified().toString(), QString::number( info->size() ), |
657 | dir, locked ); | 649 | dir, locked ); |
658 | } | 650 | } |
659 | 651 | ||
660 | void OFileViewFileListView::addDir( QFileInfo* info, bool symlink ) | 652 | void OFileViewFileListView::addDir( QFileInfo* info, bool symlink ) |
661 | { | 653 | { |
662 | bool locked = false; QString name; QPixmap pix; | 654 | bool locked = false; QString name; QPixmap pix; |
663 | 655 | ||
664 | if ( ( ( selector()->mode() == OFileSelector::Open ) && !info->isReadable() ) || | 656 | if ( ( ( selector()->mode() == OFileSelector::Open ) && !info->isReadable() ) || |
665 | ( ( selector()->mode() == OFileSelector::Save ) && !info->isWritable() ) ) | 657 | ( ( selector()->mode() == OFileSelector::Save ) && !info->isWritable() ) ) |
666 | { | 658 | { |
667 | locked = true; | 659 | locked = true; |
668 | if ( symlink ) | 660 | if ( symlink ) |
669 | pix = Opie::Core::OResource::loadPixmap( "opie/symlink" ); | 661 | pix = Opie::Core::OResource::loadPixmap( "opie/symlink" ); |
670 | else | 662 | else |
671 | pix = Opie::Core::OResource::loadPixmap( "lockedfolder" ); | 663 | pix = Opie::Core::OResource::loadPixmap( "lockedfolder" ); |
672 | } | 664 | } |
673 | else | 665 | else |
674 | pix = symlink ? Opie::Core::OResource::loadPixmap( "opie/symlink" ) : Opie::Core::OResource::loadPixmap( "folder" ); | 666 | pix = symlink ? Opie::Core::OResource::loadPixmap( "opie/symlink" ) : Opie::Core::OResource::loadPixmap( "folder" ); |
675 | 667 | ||
676 | name = symlink ? info->fileName() + " -> " + createNewPath(info->dirPath(true),info->readLink()) : | 668 | name = symlink ? info->fileName() + " -> " + createNewPath(info->dirPath(true),info->readLink()) : |
677 | info->fileName(); | 669 | info->fileName(); |
678 | 670 | ||
679 | (void)new OFileSelectorItem( m_view, pix, name, | 671 | (void)new OFileSelectorItem( m_view, pix, name, |
680 | info->lastModified().toString(), | 672 | info->lastModified().toString(), |
681 | QString::number( info->size() ), | 673 | QString::number( info->size() ), |
682 | info->dirPath( true ), locked, true ); | 674 | info->dirPath( true ), locked, true ); |
683 | 675 | ||
684 | 676 | ||
685 | } | 677 | } |
686 | 678 | ||
687 | void OFileViewFileListView::addSymlink( QFileInfo* , bool ) | 679 | void OFileViewFileListView::addSymlink( QFileInfo* , bool ) |
688 | { | 680 | { |
689 | } | 681 | } |
690 | 682 | ||
691 | void OFileViewFileListView::cdUP() | 683 | void OFileViewFileListView::cdUP() |
692 | { | 684 | { |
693 | QDir dir( m_currentDir ); | 685 | QDir dir( m_currentDir ); |
694 | dir.cdUp(); | 686 | dir.cdUp(); |
695 | 687 | ||
696 | if (!dir.exists() ) | 688 | if (!dir.exists() ) |
697 | m_currentDir = "/"; | 689 | m_currentDir = "/"; |
698 | else | 690 | else |
699 | m_currentDir = dir.absPath(); | 691 | m_currentDir = dir.absPath(); |
700 | 692 | ||