author | llornkcor <llornkcor> | 2003-04-15 01:46:54 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2003-04-15 01:46:54 (UTC) |
commit | d2f7c238e852eb60fdcfe3e4024823480713e50e (patch) (unidiff) | |
tree | 0109f1fc75cd7477581cb2cfac1a349fcb44c6ef | |
parent | 79e83da7936995f247f7ad7ad0f768b6e2545cf1 (diff) | |
download | opie-d2f7c238e852eb60fdcfe3e4024823480713e50e.zip opie-d2f7c238e852eb60fdcfe3e4024823480713e50e.tar.gz opie-d2f7c238e852eb60fdcfe3e4024823480713e50e.tar.bz2 |
fixed for bug 855, changed currentChanged(...) to clicked(...). also changed UnknownDocument-14 to scaled UnknownDocument
-rw-r--r-- | libopie/ofileselector.cc | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/libopie/ofileselector.cc b/libopie/ofileselector.cc index 7481360..6748bec 100644 --- a/libopie/ofileselector.cc +++ b/libopie/ofileselector.cc | |||
@@ -1,26 +1,27 @@ | |||
1 | 1 | ||
2 | 2 | ||
3 | #include <qwmatrix.h> | ||
3 | #include <qcheckbox.h> | 4 | #include <qcheckbox.h> |
4 | #include <qcombobox.h> | 5 | #include <qcombobox.h> |
5 | #include <qheader.h> | 6 | #include <qheader.h> |
6 | #include <qlabel.h> | 7 | #include <qlabel.h> |
7 | #include <qabstractlayout.h> | 8 | #include <qabstractlayout.h> |
8 | #include <qlayout.h> | 9 | #include <qlayout.h> |
9 | #include <qlineedit.h> | 10 | #include <qlineedit.h> |
10 | #include <qlistview.h> | 11 | #include <qlistview.h> |
11 | #include <qmessagebox.h> | 12 | #include <qmessagebox.h> |
12 | #include <qpainter.h> | 13 | #include <qpainter.h> |
13 | #include <qpushbutton.h> | 14 | #include <qpushbutton.h> |
14 | #include <qwidgetstack.h> | 15 | #include <qwidgetstack.h> |
15 | #include <qpopupmenu.h> | 16 | #include <qpopupmenu.h> |
16 | #include <qdir.h> | 17 | #include <qdir.h> |
17 | #include <qfile.h> | 18 | #include <qfile.h> |
18 | #include <qfileinfo.h> | 19 | #include <qfileinfo.h> |
19 | #include <qtimer.h> | 20 | #include <qtimer.h> |
20 | 21 | ||
21 | #include <qpe/qpeapplication.h> | 22 | #include <qpe/qpeapplication.h> |
22 | #include <qpe/applnk.h> | 23 | #include <qpe/applnk.h> |
23 | #include <qpe/fileselector.h> | 24 | #include <qpe/fileselector.h> |
24 | #include <qpe/global.h> | 25 | #include <qpe/global.h> |
25 | #include <qpe/mimetype.h> | 26 | #include <qpe/mimetype.h> |
26 | #include <qpe/resource.h> | 27 | #include <qpe/resource.h> |
@@ -113,49 +114,48 @@ OFileSelector::OFileSelector( QWidget *wid, int mode, int selector, | |||
113 | init(); | 114 | init(); |
114 | //QTimer::singleShot(6*1000, this, SLOT( slotTest() ) ); | 115 | //QTimer::singleShot(6*1000, this, SLOT( slotTest() ) ); |
115 | } | 116 | } |
116 | 117 | ||
117 | OFileSelector::OFileSelector(const QString &mimeFilter, QWidget *parent, | 118 | OFileSelector::OFileSelector(const QString &mimeFilter, QWidget *parent, |
118 | const char *name, bool newVisible, | 119 | const char *name, bool newVisible, |
119 | bool closeVisible ) | 120 | bool closeVisible ) |
120 | : QWidget( parent, name ) | 121 | : QWidget( parent, name ) |
121 | { | 122 | { |
122 | if (!mimeFilter.isEmpty() ) { | 123 | if (!mimeFilter.isEmpty() ) { |
123 | QStringList list = QStringList::split(";", mimeFilter ); | 124 | QStringList list = QStringList::split(";", mimeFilter ); |
124 | m_mimetypes.insert(mimeFilter, list ); | 125 | m_mimetypes.insert(mimeFilter, list ); |
125 | } | 126 | } |
126 | initVars(); | 127 | initVars(); |
127 | m_currentDir = QPEApplication::documentDir(); | 128 | m_currentDir = QPEApplication::documentDir(); |
128 | m_mode = FILESELECTOR; | 129 | m_mode = FILESELECTOR; |
129 | m_selector = NORMAL; | 130 | m_selector = NORMAL; |
130 | m_shClose = closeVisible; | 131 | m_shClose = closeVisible; |
131 | m_shNew = newVisible; | 132 | m_shNew = newVisible; |
132 | m_shLne = false; | 133 | m_shLne = false; |
133 | m_shPerm = false; | 134 | m_shPerm = false; |
134 | m_shYesNo = false; | 135 | m_shYesNo = false; |
135 | init(); | 136 | init(); |
136 | 137 | ||
137 | |||
138 | } | 138 | } |
139 | 139 | ||
140 | OFileSelector::~OFileSelector() | 140 | OFileSelector::~OFileSelector() |
141 | { | 141 | { |
142 | 142 | ||
143 | 143 | ||
144 | } | 144 | } |
145 | 145 | ||
146 | void OFileSelector::setNewVisible( bool visible ) | 146 | void OFileSelector::setNewVisible( bool visible ) |
147 | { | 147 | { |
148 | m_shNew = visible; | 148 | m_shNew = visible; |
149 | if( m_selector == NORMAL ){ | 149 | if( m_selector == NORMAL ){ |
150 | delete m_select; | 150 | delete m_select; |
151 | // we need to initialize but keep the selected mimetype | 151 | // we need to initialize but keep the selected mimetype |
152 | QString mime = currentMimeType(); | 152 | QString mime = currentMimeType(); |
153 | m_select = new FileSelector( mime , | 153 | m_select = new FileSelector( mime , |
154 | m_stack, "fileselector", | 154 | m_stack, "fileselector", |
155 | m_shNew, m_shClose); | 155 | m_shNew, m_shClose); |
156 | connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ), | 156 | connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ), |
157 | this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) ); | 157 | this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) ); |
158 | connect(m_select, SIGNAL(closeMe() ), | 158 | connect(m_select, SIGNAL(closeMe() ), |
159 | this, SIGNAL(closeMe() ) ); | 159 | this, SIGNAL(closeMe() ) ); |
160 | //connect to close me and other signals as well | 160 | //connect to close me and other signals as well |
161 | m_stack->addWidget( m_select, NORMAL ); | 161 | m_stack->addWidget( m_select, NORMAL ); |
@@ -675,50 +675,56 @@ void OFileSelector::initVars() | |||
675 | m_boxToolbar = 0; | 675 | m_boxToolbar = 0; |
676 | m_boxOk = 0; | 676 | m_boxOk = 0; |
677 | m_boxName = 0; | 677 | m_boxName = 0; |
678 | m_boxView = 0; | 678 | m_boxView = 0; |
679 | m_custom = 0; | 679 | m_custom = 0; |
680 | m_edit = 0; | 680 | m_edit = 0; |
681 | m_fnLabel = 0; | 681 | m_fnLabel = 0; |
682 | m_new = 0; | 682 | m_new = 0; |
683 | m_close = 0; | 683 | m_close = 0; |
684 | } | 684 | } |
685 | void OFileSelector::addFile(const QString &/*mime*/, QFileInfo *info, bool symlink) | 685 | void OFileSelector::addFile(const QString &/*mime*/, QFileInfo *info, bool symlink) |
686 | { | 686 | { |
687 | if(!m_files) | 687 | if(!m_files) |
688 | return; | 688 | return; |
689 | // if( !compliesMime(info->absFilePath(), mime ) ) | 689 | // if( !compliesMime(info->absFilePath(), mime ) ) |
690 | // return; | 690 | // return; |
691 | MimeType type( info->absFilePath() ); | 691 | MimeType type( info->absFilePath() ); |
692 | if (!compliesMime( type.id() ) ) | 692 | if (!compliesMime( type.id() ) ) |
693 | return; | 693 | return; |
694 | 694 | ||
695 | QPixmap pix = type.pixmap(); | 695 | QPixmap pix = type.pixmap(); |
696 | QString dir; | 696 | QString dir; |
697 | QString name; | 697 | QString name; |
698 | bool locked; | 698 | bool locked; |
699 | if( pix.isNull() ) | 699 | if( pix.isNull() ) { |
700 | pix = Resource::loadPixmap( "UnknownDocument-14"); | 700 | //TODO make this scaled pixmap global, so we dont have to keep doing this |
701 | QWMatrix matrix; | ||
702 | QPixmap pixer(Resource::loadPixmap( "UnknownDocument" )); | ||
703 | matrix.scale( .4, .4); | ||
704 | pix = pixer.xForm(matrix); | ||
705 | // pix = Resource::loadPixmap( "UnknownDocument-14"); | ||
706 | } | ||
701 | dir = info->dirPath( true ); | 707 | dir = info->dirPath( true ); |
702 | if( symlink ) | 708 | if( symlink ) |
703 | name = info->fileName() + " -> " +info->dirPath() + "/" + info->readLink(); | 709 | name = info->fileName() + " -> " +info->dirPath() + "/" + info->readLink(); |
704 | else { | 710 | else { |
705 | name = info->fileName(); | 711 | name = info->fileName(); |
706 | if( ( m_mode == OPEN && !info->isReadable() )|| | 712 | if( ( m_mode == OPEN && !info->isReadable() )|| |
707 | ( m_mode == SAVE && !info->isWritable() ) ){ | 713 | ( m_mode == SAVE && !info->isWritable() ) ){ |
708 | 714 | ||
709 | locked = true; pix = Resource::loadPixmap("locked"); | 715 | locked = true; pix = Resource::loadPixmap("locked"); |
710 | } | 716 | } |
711 | } | 717 | } |
712 | new OFileSelectorItem( m_View, pix, name, | 718 | new OFileSelectorItem( m_View, pix, name, |
713 | info->lastModified().toString(), | 719 | info->lastModified().toString(), |
714 | QString::number( info->size() ), | 720 | QString::number( info->size() ), |
715 | dir, locked ); | 721 | dir, locked ); |
716 | } | 722 | } |
717 | void OFileSelector::addDir(const QString &/*mime*/, QFileInfo *info, bool symlink ) | 723 | void OFileSelector::addDir(const QString &/*mime*/, QFileInfo *info, bool symlink ) |
718 | { | 724 | { |
719 | if(!m_dir) | 725 | if(!m_dir) |
720 | return; | 726 | return; |
721 | if( m_selector == EXTENDED_ALL || m_selector == EXTENDED ){ | 727 | if( m_selector == EXTENDED_ALL || m_selector == EXTENDED ){ |
722 | bool locked = false; | 728 | bool locked = false; |
723 | QString name; | 729 | QString name; |
724 | QPixmap pix; | 730 | QPixmap pix; |
@@ -901,49 +907,50 @@ void OFileSelector::initializeListView() | |||
901 | if(!m_shClose ) | 907 | if(!m_shClose ) |
902 | m_close->hide(); | 908 | m_close->hide(); |
903 | //if(!m_shNew) | 909 | //if(!m_shNew) |
904 | //m_close->hide(); | 910 | //m_close->hide(); |
905 | 911 | ||
906 | } // off toolbar | 912 | } // off toolbar |
907 | // the Main ListView | 913 | // the Main ListView |
908 | // make a QWidgetStack first so Views can share the Toolbar | 914 | // make a QWidgetStack first so Views can share the Toolbar |
909 | m_View = new QListView( m_pseudo, "Extended view"); | 915 | m_View = new QListView( m_pseudo, "Extended view"); |
910 | QPEApplication::setStylusOperation( m_View->viewport(), | 916 | QPEApplication::setStylusOperation( m_View->viewport(), |
911 | QPEApplication::RightOnHold); | 917 | QPEApplication::RightOnHold); |
912 | m_View->addColumn(" " ); | 918 | m_View->addColumn(" " ); |
913 | m_View->addColumn(tr("Name"), 135 ); | 919 | m_View->addColumn(tr("Name"), 135 ); |
914 | m_View->addColumn(tr("Size"), -1 ); | 920 | m_View->addColumn(tr("Size"), -1 ); |
915 | m_View->addColumn(tr("Date"), 60 ); | 921 | m_View->addColumn(tr("Date"), 60 ); |
916 | m_View->addColumn(tr("Mime Type"), -1 ); | 922 | m_View->addColumn(tr("Mime Type"), -1 ); |
917 | QHeader *header = m_View->header(); | 923 | QHeader *header = m_View->header(); |
918 | header->hide(); | 924 | header->hide(); |
919 | m_View->setSorting( 1 ); | 925 | m_View->setSorting( 1 ); |
920 | m_View->setAllColumnsShowFocus( TRUE ); | 926 | m_View->setAllColumnsShowFocus( TRUE ); |
921 | 927 | ||
922 | connect(m_View, SIGNAL(selectionChanged() ), | 928 | connect(m_View, SIGNAL(selectionChanged() ), |
923 | this, SLOT(slotSelectionChanged() ) ); | 929 | this, SLOT(slotSelectionChanged() ) ); |
924 | 930 | ||
925 | connect(m_View, SIGNAL(currentChanged(QListViewItem *) ), | 931 | connect(m_View, SIGNAL(clicked(QListViewItem *) ), |
932 | // connect(m_View, SIGNAL(currentChanged(QListViewItem *) ), | ||
926 | this, SLOT(slotCurrentChanged(QListViewItem * ) ) ); | 933 | this, SLOT(slotCurrentChanged(QListViewItem * ) ) ); |
927 | 934 | ||
928 | connect(m_View, SIGNAL(mouseButtonClicked(int, QListViewItem*, const QPoint &, int) ), | 935 | connect(m_View, SIGNAL(mouseButtonClicked(int, QListViewItem*, const QPoint &, int) ), |
929 | this, SLOT(slotClicked( int, QListViewItem *, const QPoint &, int) ) ); | 936 | this, SLOT(slotClicked( int, QListViewItem *, const QPoint &, int) ) ); |
930 | 937 | ||
931 | connect(m_View, SIGNAL(mouseButtonPressed(int, QListViewItem *, const QPoint &, int )), | 938 | connect(m_View, SIGNAL(mouseButtonPressed(int, QListViewItem *, const QPoint &, int )), |
932 | this, SLOT(slotRightButton(int, QListViewItem *, const QPoint &, int ) ) ); | 939 | this, SLOT(slotRightButton(int, QListViewItem *, const QPoint &, int ) ) ); |
933 | 940 | ||
934 | m_pseudoLayout->addWidget( m_View, 288 ); | 941 | m_pseudoLayout->addWidget( m_View, 288 ); |
935 | m_stack->addWidget( m_pseudo, EXTENDED ); | 942 | m_stack->addWidget( m_pseudo, EXTENDED ); |
936 | } | 943 | } |
937 | } | 944 | } |
938 | void OFileSelector::initializePerm() | 945 | void OFileSelector::initializePerm() |
939 | { | 946 | { |
940 | if( m_checkPerm == 0 ){ | 947 | if( m_checkPerm == 0 ){ |
941 | m_checkPerm = new QCheckBox(tr("Ser Permission"), this, "perm"); | 948 | m_checkPerm = new QCheckBox(tr("Ser Permission"), this, "perm"); |
942 | m_checkPerm->setChecked( false ); | 949 | m_checkPerm->setChecked( false ); |
943 | m_lay->addWidget( m_checkPerm ); | 950 | m_lay->addWidget( m_checkPerm ); |
944 | 951 | ||
945 | } | 952 | } |
946 | } | 953 | } |
947 | void OFileSelector::initPics() | 954 | void OFileSelector::initPics() |
948 | { | 955 | { |
949 | m_pixmaps = new QMap<QString,QPixmap>; | 956 | m_pixmaps = new QMap<QString,QPixmap>; |