summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-06-18 18:03:50 (UTC)
committer zautrix <zautrix>2005-06-18 18:03:50 (UTC)
commit3d86c369e8b48b340e4093b034f1347defea876b (patch) (unidiff)
tree50becb886d75770ce35108f4f97837b6b9d5664f
parent45c93de5a458e7ca0c293eebe504a9d949cc045c (diff)
downloadkdepimpi-3d86c369e8b48b340e4093b034f1347defea876b.zip
kdepimpi-3d86c369e8b48b340e4093b034f1347defea876b.tar.gz
kdepimpi-3d86c369e8b48b340e4093b034f1347defea876b.tar.bz2
file dialog fixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/ofileselector_p.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/microkde/ofileselector_p.cpp b/microkde/ofileselector_p.cpp
index e2af32b..488dee2 100644
--- a/microkde/ofileselector_p.cpp
+++ b/microkde/ofileselector_p.cpp
@@ -136,58 +136,59 @@ QWidget* ODocumentFileView::widget( QWidget* parent ) {
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
153OFileSelectorItem::OFileSelectorItem( QListView* view, const QPixmap& pixmap, 153OFileSelectorItem::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 159
160 QString kind; 160 QString kind = "dir";;
161 QString _path = path; 161 QString _path = path;
162 if ( isDir ) 162 if ( !isDir ){
163 kind = "dir"; 163 int arrow = path.findRev( "." ,-1);
164 else 164 if (arrow > 0 ) {
165 kind = "file"; 165 kind = path.mid(arrow+1);
166 }
167 }
166 setPixmap(0, pixmap ); 168 setPixmap(0, pixmap );
167 int arrow = path.find( "->" ); 169 int arrow = path.find( "->" );
168 if (arrow > 0 ) { 170 if (arrow > 0 ) {
169 kind += path.mid( arrow );
170 _path = path.left(arrow); 171 _path = path.left(arrow);
171 } 172 }
172 setText(1, _path ); 173 setText(1, _path );
173 setText(2, size ); 174 setText(2, size );
174 setText(3, date ); 175 setText(3, date );
175 setText(4, kind ); 176 setText(4, kind );
176 m_isDir = isDir; 177 m_isDir = isDir;
177 m_dir = dir; 178 m_dir = dir;
178 m_locked = isLocked; 179 m_locked = isLocked;
179} 180}
180OFileSelectorItem::~OFileSelectorItem() { 181OFileSelectorItem::~OFileSelectorItem() {
181 182
182} 183}
183bool OFileSelectorItem::isLocked()const { 184bool OFileSelectorItem::isLocked()const {
184 return m_locked; 185 return m_locked;
185} 186}
186QString OFileSelectorItem::directory()const { 187QString OFileSelectorItem::directory()const {
187 return m_dir; 188 return m_dir;
188} 189}
189bool OFileSelectorItem::isDir()const { 190bool OFileSelectorItem::isDir()const {
190 return m_isDir; 191 return m_isDir;
191} 192}
192QString OFileSelectorItem::path()const { 193QString OFileSelectorItem::path()const {
193 return text( 1 ); 194 return text( 1 );
@@ -270,51 +271,51 @@ OFileViewFileListView::OFileViewFileListView( QWidget* parent, const QString& st
270 271
271 StorageInfo storage; 272 StorageInfo storage;
272 const QList<FileSystem> &fs = storage.fileSystems(); 273 const QList<FileSystem> &fs = storage.fileSystems();
273 QListIterator<FileSystem> it(fs); 274 QListIterator<FileSystem> it(fs);
274 for ( ; it.current(); ++it ) { 275 for ( ; it.current(); ++it ) {
275 const QString disk = (*it)->name(); 276 const QString disk = (*it)->name();
276 const QString path = (*it)->path(); 277 const QString path = (*it)->path();
277 m_dev.insert( disk, path ); 278 m_dev.insert( disk, path );
278 pop->insertItem( disk ); 279 pop->insertItem( disk );
279 } 280 }
280 m_fsPop = pop; 281 m_fsPop = pop;
281 282
282 283
283 btn->setPopup( pop ); 284 btn->setPopup( pop );
284 btn->setPopupDelay ( 0 ); 285 btn->setPopupDelay ( 0 );
285 lay->addWidget( box ); 286 lay->addWidget( box );
286 287
287 m_view = new QListView( this ); 288 m_view = new QListView( this );
288 289
289 m_view->installEventFilter(this); 290 m_view->installEventFilter(this);
290 291
291 QPEApplication::setStylusOperation( m_view->viewport(), 292 QPEApplication::setStylusOperation( m_view->viewport(),
292 QPEApplication::RightOnHold); 293 QPEApplication::RightOnHold);
293 m_view->addColumn(" " ); 294 m_view->addColumn(" " );
294 m_view->addColumn(i18n("Name"), 135 ); 295 m_view->addColumn(i18n("Name"), 150 );
295 m_view->addColumn(i18n("Size"), -1 ); 296 m_view->addColumn(i18n("Size"), -1 );
296 m_view->addColumn(i18n("Date"), 60 ); 297 m_view->addColumn(i18n("Date"), -1 );
297 m_view->addColumn(i18n("Mime Type"), -1 ); 298 m_view->addColumn(i18n("Mime Type"), -1 );
298 299
299 300
300 m_view->setSorting( 1 ); 301 m_view->setSorting( 1 );
301 m_view->setAllColumnsShowFocus( TRUE ); 302 m_view->setAllColumnsShowFocus( TRUE );
302 303
303 lay->addWidget( m_view, 1000 ); 304 lay->addWidget( m_view, 1000 );
304 connectSlots(); 305 connectSlots();
305} 306}
306OFileViewFileListView::~OFileViewFileListView() { 307OFileViewFileListView::~OFileViewFileListView() {
307} 308}
308void OFileViewFileListView::slotNew() { 309void OFileViewFileListView::slotNew() {
309 DocLnk lnk; 310 DocLnk lnk;
310 emit selector()->newSelected( lnk ); 311 emit selector()->newSelected( lnk );
311} 312}
312OFileSelectorItem* OFileViewFileListView::currentItem()const{ 313OFileSelectorItem* OFileViewFileListView::currentItem()const{
313 QListViewItem* item = m_view->currentItem(); 314 QListViewItem* item = m_view->currentItem();
314 if (!item ) 315 if (!item )
315 return 0l; 316 return 0l;
316 317
317 return static_cast<OFileSelectorItem*>(item); 318 return static_cast<OFileSelectorItem*>(item);
318} 319}
319void OFileViewFileListView::reread( bool all ) { 320void OFileViewFileListView::reread( bool all ) {
320 m_view->clear(); 321 m_view->clear();