summaryrefslogtreecommitdiff
path: root/libopie2/opieui
Unidiff
Diffstat (limited to 'libopie2/opieui') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opieui/fileselector/ofiledialog.cpp4
-rw-r--r--libopie2/opieui/fileselector/ofileselector.cpp14
-rw-r--r--libopie2/opieui/ofontselector.cpp8
-rw-r--r--libopie2/opieui/otabwidget.cpp4
-rw-r--r--libopie2/opieui/otimepicker.cpp12
-rw-r--r--libopie2/opieui/oversatileview.cpp40
6 files changed, 41 insertions, 41 deletions
diff --git a/libopie2/opieui/fileselector/ofiledialog.cpp b/libopie2/opieui/fileselector/ofiledialog.cpp
index 2a89c5d..e7daead 100644
--- a/libopie2/opieui/fileselector/ofiledialog.cpp
+++ b/libopie2/opieui/fileselector/ofiledialog.cpp
@@ -66,98 +66,98 @@ void saveLastDir( const QString& key, const QString& file )
66{ 66{
67 if ( qApp->argc() < 1 ) 67 if ( qApp->argc() < 1 )
68 return; 68 return;
69 69
70 Config cfg( QFileInfo(qApp->argv()[0]).fileName() ); 70 Config cfg( QFileInfo(qApp->argv()[0]).fileName() );
71 cfg.setGroup( key ); 71 cfg.setGroup( key );
72 QFileInfo inf( file ); 72 QFileInfo inf( file );
73 cfg.writeEntry("LastDir", inf.dirPath( true ) ); 73 cfg.writeEntry("LastDir", inf.dirPath( true ) );
74} 74}
75}; 75};
76 76
77/** 77/**
78 * This constructs a modal dialog 78 * This constructs a modal dialog
79 * 79 *
80 * @param caption The caption of the dialog 80 * @param caption The caption of the dialog
81 * @param wid The parent widget 81 * @param wid The parent widget
82 * @param mode The mode of the OFileSelector @see OFileSelector 82 * @param mode The mode of the OFileSelector @see OFileSelector
83 * @param selector The selector of the OFileSelector 83 * @param selector The selector of the OFileSelector
84 * @param dirName the dir or resource to start from 84 * @param dirName the dir or resource to start from
85 * @param fileName a proposed or existing filename 85 * @param fileName a proposed or existing filename
86 * @param mimetypes The mimeTypes 86 * @param mimetypes The mimeTypes
87 */ 87 */
88OFileDialog::OFileDialog(const QString &caption, 88OFileDialog::OFileDialog(const QString &caption,
89 QWidget *wid, int mode, int selector, 89 QWidget *wid, int mode, int selector,
90 const QString &dirName, 90 const QString &dirName,
91 const QString &fileName, 91 const QString &fileName,
92 const QMap<QString,QStringList>& mimetypes ) 92 const QMap<QString,QStringList>& mimetypes )
93 : QDialog( wid, "OFileDialog", true ) 93 : QDialog( wid, "OFileDialog", true )
94{ 94{
95 // QVBoxLayout *lay = new QVBoxLayout(this); 95 // QVBoxLayout *lay = new QVBoxLayout(this);
96 //showMaximized(); 96 //showMaximized();
97 QVBoxLayout *lay = new QVBoxLayout(this ); 97 QVBoxLayout *lay = new QVBoxLayout(this );
98 file = new OFileSelector(this , mode, selector, 98 file = new OFileSelector(this , mode, selector,
99 dirName, fileName, 99 dirName, fileName,
100 mimetypes ); 100 mimetypes );
101 lay->addWidget( file ); 101 lay->addWidget( file );
102 102
103 //lay->addWidget( file ); 103 //lay->addWidget( file );
104 //showFullScreen(); 104 //showFullScreen();
105 setCaption( caption.isEmpty() ? tr("FileDialog") : caption ); 105 setCaption( caption.isEmpty() ? tr("FileDialog") : caption );
106 connect(file, SIGNAL(fileSelected(const QString&) ), 106 connect(file, SIGNAL(fileSelected(const QString&) ),
107 this, SLOT(slotFileSelected(const QString&) ) ); 107 this, SLOT(slotFileSelected(const QString&) ) );
108 connect(file, SIGNAL(ok() ), 108 connect(file, SIGNAL(ok() ),
109 this, SLOT(slotSelectorOk()) ) ; 109 this, SLOT(slotSelectorOk()) ) ;
110 110
111 connect(file, SIGNAL(dirSelected(const QString&) ), this, SLOT(slotDirSelected(const QString&) ) ); 111 connect(file, SIGNAL(dirSelected(const QString&) ), this, SLOT(slotDirSelected(const QString&) ) );
112 112
113#if 0 113#if 0
114 connect(file, SIGNAL(dirSelected(const QString &) ), 114 connect(file, SIGNAL(dirSelected(const QString&) ),
115 this, SLOT(slotDirSelected(const QString &) ) ); 115 this, SLOT(slotDirSelected(const QString&) ) );
116#endif 116#endif
117} 117}
118/** 118/**
119 * @returns the mimetype of the selected 119 * @returns the mimetype of the selected
120 * currently it return QString::null 120 * currently it return QString::null
121 */ 121 */
122QString OFileDialog::mimetype()const 122QString OFileDialog::mimetype()const
123{ 123{
124 return QString::null; 124 return QString::null;
125} 125}
126 126
127/** 127/**
128 * @return the fileName 128 * @return the fileName
129 */ 129 */
130QString OFileDialog::fileName()const 130QString OFileDialog::fileName()const
131{ 131{
132 return file->selectedName(); 132 return file->selectedName();
133} 133}
134 134
135/** 135/**
136 * return a DocLnk to the current file 136 * return a DocLnk to the current file
137 */ 137 */
138DocLnk OFileDialog::selectedDocument()const 138DocLnk OFileDialog::selectedDocument()const
139{ 139{
140 return file->selectedDocument(); 140 return file->selectedDocument();
141} 141}
142 142
143/** 143/**
144 * This opens up a filedialog in Open mode 144 * This opens up a filedialog in Open mode
145 * 145 *
146 * @param selector the Selector Mode 146 * @param selector the Selector Mode
147 * @param startDir Where to start from 147 * @param startDir Where to start from
148 * @param file A proposed filename 148 * @param file A proposed filename
149 * @param mimes A list of MimeTypes 149 * @param mimes A list of MimeTypes
150 * @param wid the parent 150 * @param wid the parent
151 * @param caption of the dialog if QString::null tr("Open") will be used 151 * @param caption of the dialog if QString::null tr("Open") will be used
152 * @return the fileName or QString::null 152 * @return the fileName or QString::null
153 */ 153 */
154QString OFileDialog::getOpenFileName(int selector, 154QString OFileDialog::getOpenFileName(int selector,
155 const QString &_startDir, 155 const QString &_startDir,
156 const QString &file, 156 const QString &file,
157 const MimeTypes &mimes, 157 const MimeTypes &mimes,
158 QWidget *wid, 158 QWidget *wid,
159 const QString &caption ) 159 const QString &caption )
160{ 160{
161 QString ret; 161 QString ret;
162 QString startDir = _startDir; 162 QString startDir = _startDir;
163 if (startDir.isEmpty() ) 163 if (startDir.isEmpty() )
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
@@ -165,102 +165,102 @@ QString ODocumentFileView::selectedName()const
165 if (!m_selector) 165 if (!m_selector)
166 return QString::null; 166 return QString::null;
167 167
168 return m_selector->selectedDocument().file(); 168 return m_selector->selectedDocument().file();
169} 169}
170 170
171QString ODocumentFileView::selectedPath()const 171QString ODocumentFileView::selectedPath()const
172{ 172{
173 return QPEApplication::documentDir(); 173 return QPEApplication::documentDir();
174} 174}
175 175
176QString ODocumentFileView::directory()const 176QString ODocumentFileView::directory()const
177{ 177{
178 return selectedPath(); 178 return selectedPath();
179} 179}
180 180
181void ODocumentFileView::reread() 181void ODocumentFileView::reread()
182{ 182{
183 if (!m_selector) 183 if (!m_selector)
184 return; 184 return;
185 185
186 m_selector->setNewVisible( showNew() ); 186 m_selector->setNewVisible( showNew() );
187 m_selector->setCloseVisible( showClose() ); 187 m_selector->setCloseVisible( showClose() );
188 m_selector->filter = currentMimeType().join(";"); 188 m_selector->filter = currentMimeType().join(";");
189 m_selector->reread(); 189 m_selector->reread();
190} 190}
191 191
192int ODocumentFileView::fileCount()const 192int 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
200DocLnk ODocumentFileView::selectedDocument()const 200DocLnk 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
208QWidget* ODocumentFileView::widget( QWidget* parent ) 208QWidget* 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
229OFileSelectorItem::OFileSelectorItem( QListView* view, const QPixmap& pixmap, 229OFileSelectorItem::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}
243 243
244OFileSelectorItem::~OFileSelectorItem() 244OFileSelectorItem::~OFileSelectorItem()
245{ 245{
246} 246}
247 247
248bool OFileSelectorItem::isLocked()const 248bool OFileSelectorItem::isLocked()const
249{ 249{
250 return m_locked; 250 return m_locked;
251} 251}
252 252
253QString OFileSelectorItem::directory()const 253QString OFileSelectorItem::directory()const
254{ 254{
255 return m_dir; 255 return m_dir;
256} 256}
257 257
258bool OFileSelectorItem::isDir()const 258bool OFileSelectorItem::isDir()const
259{ 259{
260 return m_isDir; 260 return m_isDir;
261} 261}
262 262
263QString OFileSelectorItem::path()const 263QString OFileSelectorItem::path()const
264{ 264{
265 return text( 1 ); 265 return text( 1 );
266} 266}
@@ -479,98 +479,98 @@ void OFileViewFileListView::reread( bool all )
479 { // couldn't resolve symlink add it as symlink 479 { // couldn't resolve symlink add it as symlink
480 addSymlink( fi ); 480 addSymlink( fi );
481 } 481 }
482 } // off for loop for symlink resolving 482 } // off for loop for symlink resolving
483 } 483 }
484 else if( fi->isDir() ) 484 else if( fi->isDir() )
485 addDir( fi ); 485 addDir( fi );
486 else if( fi->isFile() ) 486 else if( fi->isFile() )
487 addFile( fi ); 487 addFile( fi );
488 488
489 ++it; 489 ++it;
490 } // of while loop 490 } // of while loop
491 m_view->sort(); 491 m_view->sort();
492 492
493} 493}
494int OFileViewFileListView::fileCount()const 494int OFileViewFileListView::fileCount()const
495{ 495{
496 return m_view->childCount(); 496 return m_view->childCount();
497} 497}
498 498
499QString OFileViewFileListView::currentDir()const 499QString OFileViewFileListView::currentDir()const
500{ 500{
501 return m_currentDir; 501 return m_currentDir;
502} 502}
503 503
504OFileSelector* OFileViewFileListView::selector() 504OFileSelector* OFileViewFileListView::selector()
505{ 505{
506 return m_sel; 506 return m_sel;
507} 507}
508 508
509bool OFileViewFileListView::eventFilter (QObject *o, QEvent *e) 509bool 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
523void OFileViewFileListView::connectSlots() 523void 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
531void OFileViewFileListView::slotCurrentChanged( QListViewItem* item) 531void 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 }
553#endif 553#endif
554} 554}
555 555
556void OFileViewFileListView::slotClicked(int button , QListViewItem* item, const QPoint&, int ) 556void OFileViewFileListView::slotClicked(int button , QListViewItem* item, const QPoint&, int )
557{ 557{
558 if (!item || ( button != Qt::LeftButton) ) 558 if (!item || ( button != Qt::LeftButton) )
559 return; 559 return;
560 560
561 OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item); 561 OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item);
562 if (!sel->isLocked() ) 562 if (!sel->isLocked() )
563 { 563 {
564 QStringList str = QStringList::split("->", sel->text(1) ); 564 QStringList str = QStringList::split("->", sel->text(1) );
565 if (sel->isDir() ) 565 if (sel->isDir() )
566 { 566 {
567 m_currentDir = sel->directory() + "/" + str[0].stripWhiteSpace(); 567 m_currentDir = sel->directory() + "/" + str[0].stripWhiteSpace();
568 emit selector()->dirSelected( m_currentDir ); 568 emit selector()->dirSelected( m_currentDir );
569 reread( m_all ); 569 reread( m_all );
570 } 570 }
571 else 571 else
572 { // file 572 { // file
573 qWarning("slot Clicked"); 573 qWarning("slot Clicked");
574 selector()->m_lneEdit->setText( str[0].stripWhiteSpace() ); 574 selector()->m_lneEdit->setText( str[0].stripWhiteSpace() );
575 QString path = sel->directory() + "/" + str[0].stripWhiteSpace(); 575 QString path = sel->directory() + "/" + str[0].stripWhiteSpace();
576 emit selector()->fileSelected( path ); 576 emit selector()->fileSelected( path );
@@ -934,98 +934,98 @@ void OFileSelector::initUI()
934 m_cmbView = new QComboBox( m_cmbBox ); 934 m_cmbView = new QComboBox( m_cmbBox );
935 m_cmbMime = new QComboBox( m_cmbBox ); 935 m_cmbMime = new QComboBox( m_cmbBox );
936 lay->addWidget( m_cmbBox ); 936 lay->addWidget( m_cmbBox );
937} 937}
938 938
939/* 939/*
940 * This will make sure that the return key in the name edit causes dialogs to close 940 * This will make sure that the return key in the name edit causes dialogs to close
941 */ 941 */
942 942
943bool OFileSelector::eventFilter (QObject *o, QEvent *e) 943bool OFileSelector::eventFilter (QObject *o, QEvent *e)
944{ 944{
945 if ( e->type() == QEvent::KeyPress ) 945 if ( e->type() == QEvent::KeyPress )
946 { 946 {
947 QKeyEvent *k = (QKeyEvent *)e; 947 QKeyEvent *k = (QKeyEvent *)e;
948 if ( (k->key()==Key_Enter) || (k->key()==Key_Return)) 948 if ( (k->key()==Key_Enter) || (k->key()==Key_Return))
949 { 949 {
950 emit ok(); 950 emit ok();
951 return true; 951 return true;
952 } 952 }
953 } 953 }
954 return false; 954 return false;
955} 955}
956 956
957/* 957/*
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 */
963void OFileSelector::initMime() 963void 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
977void OFileSelector::initViews() 977void 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 */
997OFileSelector::~OFileSelector() 997OFileSelector::~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
1008 * @todo remove in ODP 1008 * @todo remove in ODP
1009 */ 1009 */
1010const DocLnk* OFileSelector::selected() 1010const DocLnk* OFileSelector::selected()
1011{ 1011{
1012 DocLnk* lnk = new DocLnk( currentView()->selectedDocument() ); 1012 DocLnk* lnk = new DocLnk( currentView()->selectedDocument() );
1013 return lnk; 1013 return lnk;
1014} 1014}
1015 1015
1016/** 1016/**
1017 * 1017 *
1018 * @return the name of the selected file 1018 * @return the name of the selected file
1019 */ 1019 */
1020QString OFileSelector::selectedName()const 1020QString OFileSelector::selectedName()const
1021{ 1021{
1022 return currentView()->selectedName(); 1022 return currentView()->selectedName();
1023} 1023}
1024 1024
1025 1025
1026/** 1026/**
1027 * @return the selected path 1027 * @return the selected path
1028 */ 1028 */
1029QString OFileSelector::selectedPath()const 1029QString OFileSelector::selectedPath()const
1030{ 1030{
1031 return currentView()->selectedPath(); 1031 return currentView()->selectedPath();
diff --git a/libopie2/opieui/ofontselector.cpp b/libopie2/opieui/ofontselector.cpp
index 49ddeb6..f93781f 100644
--- a/libopie2/opieui/ofontselector.cpp
+++ b/libopie2/opieui/ofontselector.cpp
@@ -87,111 +87,111 @@ public:
87 87
88 const QValueList<int> &sizes() const 88 const QValueList<int> &sizes() const
89 { 89 {
90 return m_sizes; 90 return m_sizes;
91 } 91 }
92 92
93private: 93private:
94 QStringList m_styles; 94 QStringList m_styles;
95 QValueList<int> m_sizes; 95 QValueList<int> m_sizes;
96 QString m_name; 96 QString m_name;
97}; 97};
98 98
99 99
100static int findItemCB( QComboBox *box, const QString &str ) 100static int findItemCB( QComboBox *box, const QString &str )
101{ 101{
102 for ( int i = 0; i < box->count(); i++ ) 102 for ( int i = 0; i < box->count(); i++ )
103 { 103 {
104 if ( box->text ( i ) == str ) 104 if ( box->text ( i ) == str )
105 return i; 105 return i;
106 } 106 }
107 return -1; 107 return -1;
108} 108}
109 109
110} 110}
111/* static same as anon. namespace */ 111/* static same as anon. namespace */
112static int qt_version() 112static int qt_version()
113{ 113{
114 const char *qver = qVersion(); 114 const char *qver = qVersion();
115 115
116 return ( qver [0] - '0' ) * 100 + ( qver [2] - '0' ) * 10 + ( qver [4] - '0' ); 116 return ( qver [0] - '0' ) * 100 + ( qver [2] - '0' ) * 10 + ( qver [4] - '0' );
117} 117}
118 118
119/** 119/**
120 * Constructs the Selector object 120 * Constructs the Selector object
121 * @param withpreview If a font preview should be given 121 * @param withpreview If a font preview should be given
122 * @param parent The parent of the Font Selector 122 * @param parent The parent of the Font Selector
123 * @param name The name of the object 123 * @param name The name of the object
124 * @param fl WidgetFlags 124 * @param fl WidgetFlags
125 */ 125 */
126OFontSelector::OFontSelector( bool withpreview, QWidget *parent, const char *name, WFlags fl ) : QWidget ( parent, name, fl ) 126OFontSelector::OFontSelector( bool withpreview, QWidget *parent, const char *name, WFlags fl ) : QWidget ( parent, name, fl )
127{ 127{
128 d = new OFontSelectorPrivate(); 128 d = new OFontSelectorPrivate();
129 129
130 QGridLayout *gridLayout = new QGridLayout( this, 0, 0, 4, 4 ); 130 QGridLayout *gridLayout = new QGridLayout( this, 0, 0, 4, 4 );
131 gridLayout->setRowStretch( 4, 10 ); 131 gridLayout->setRowStretch( 4, 10 );
132 132
133 d->m_font_family_list = new QListBox( this, "FontListBox" ); 133 d->m_font_family_list = new QListBox( this, "FontListBox" );
134 gridLayout->addMultiCellWidget( d->m_font_family_list, 0, 4, 0, 0 ); 134 gridLayout->addMultiCellWidget( d->m_font_family_list, 0, 4, 0, 0 );
135 connect( d->m_font_family_list, SIGNAL( highlighted( int ) ), this, SLOT( fontFamilyClicked( int ) ) ); 135 connect( d->m_font_family_list, SIGNAL( highlighted(int) ), this, SLOT( fontFamilyClicked(int) ) );
136 136
137 QLabel *label = new QLabel( tr( "Style" ), this ); 137 QLabel *label = new QLabel( tr( "Style" ), this );
138 gridLayout->addWidget( label, 0, 1 ); 138 gridLayout->addWidget( label, 0, 1 );
139 139
140 d->m_font_style_list = new QComboBox( this, "StyleListBox" ); 140 d->m_font_style_list = new QComboBox( this, "StyleListBox" );
141 connect( d->m_font_style_list, SIGNAL( activated( int ) ), this, SLOT( fontStyleClicked( int ) ) ); 141 connect( d->m_font_style_list, SIGNAL( activated(int) ), this, SLOT( fontStyleClicked(int) ) );
142 gridLayout->addWidget( d->m_font_style_list, 1, 1 ); 142 gridLayout->addWidget( d->m_font_style_list, 1, 1 );
143 143
144 label = new QLabel( tr( "Size" ), this ); 144 label = new QLabel( tr( "Size" ), this );
145 gridLayout->addWidget( label, 2, 1 ); 145 gridLayout->addWidget( label, 2, 1 );
146 146
147 d->m_font_size_list = new QComboBox( this, "SizeListBox" ); 147 d->m_font_size_list = new QComboBox( this, "SizeListBox" );
148 connect( d->m_font_size_list, SIGNAL( activated( int ) ), 148 connect( d->m_font_size_list, SIGNAL( activated(int) ),
149 this, SLOT( fontSizeClicked( int ) ) ); 149 this, SLOT( fontSizeClicked(int) ) );
150 gridLayout->addWidget( d->m_font_size_list, 3, 1 ); 150 gridLayout->addWidget( d->m_font_size_list, 3, 1 );
151 151
152 d->m_pointbug = ( qt_version() <= 233 ); 152 d->m_pointbug = ( qt_version() <= 233 );
153 153
154 if ( withpreview ) 154 if ( withpreview )
155 { 155 {
156 d->m_preview = new QMultiLineEdit ( this, "Preview" ); 156 d->m_preview = new QMultiLineEdit ( this, "Preview" );
157 d->m_preview->setAlignment ( AlignCenter ); 157 d->m_preview->setAlignment ( AlignCenter );
158 d->m_preview->setWordWrap ( QMultiLineEdit::WidgetWidth ); 158 d->m_preview->setWordWrap ( QMultiLineEdit::WidgetWidth );
159 d->m_preview->setMargin ( 3 ); 159 d->m_preview->setMargin ( 3 );
160 d->m_preview->setText ( tr( "The Quick Brown Fox Jumps Over The Lazy Dog" )); 160 d->m_preview->setText ( tr( "The Quick Brown Fox Jumps Over The Lazy Dog" ));
161 gridLayout->addRowSpacing ( 5, 4 ); 161 gridLayout->addRowSpacing ( 5, 4 );
162 gridLayout->addMultiCellWidget ( d->m_preview, 6, 6, 0, 1 ); 162 gridLayout->addMultiCellWidget ( d->m_preview, 6, 6, 0, 1 );
163 gridLayout->setRowStretch ( 6, 5 ); 163 gridLayout->setRowStretch ( 6, 5 );
164 } 164 }
165 else 165 else
166 d->m_preview = 0; 166 d->m_preview = 0;
167 167
168 loadFonts ( d->m_font_family_list ); 168 loadFonts ( d->m_font_family_list );
169} 169}
170 170
171OFontSelector::~OFontSelector() 171OFontSelector::~OFontSelector()
172{ 172{
173 delete d; 173 delete d;
174} 174}
175 175
176/** 176/**
177 * This methods tries to set the font 177 * This methods tries to set the font
178 * @param f The wishes font 178 * @param f The wishes font
179 * @return success or failure 179 * @return success or failure
180 */ 180 */
181bool OFontSelector::setSelectedFont ( const QFont &f ) 181bool OFontSelector::setSelectedFont ( const QFont &f )
182{ 182{
183 return setSelectedFont ( f. family(), d->m_fdb. styleString ( f ), f. pointSize(), QFont::encodingName ( f. charSet())); 183 return setSelectedFont ( f. family(), d->m_fdb. styleString ( f ), f. pointSize(), QFont::encodingName ( f. charSet()));
184} 184}
185 185
186 186
187/** 187/**
188 * This is an overloaded method @see setSelectedFont 188 * This is an overloaded method @see setSelectedFont
189 * @param familyStr The family of the font 189 * @param familyStr The family of the font
190 * @param styleStr The style of the font 190 * @param styleStr The style of the font
191 * @param sizeVal The size of font 191 * @param sizeVal The size of font
192 * @param charset The charset to be used. Will be deprecated by QT3 192 * @param charset The charset to be used. Will be deprecated by QT3
193 */ 193 */
194bool OFontSelector::setSelectedFont( const QString &familyStr, const QString &styleStr, int sizeVal, const QString & charset ) 194bool OFontSelector::setSelectedFont( const QString &familyStr, const QString &styleStr, int sizeVal, const QString & charset )
195{ 195{
196 QString sizeStr = QString::number ( sizeVal ); 196 QString sizeStr = QString::number ( sizeVal );
197 197
diff --git a/libopie2/opieui/otabwidget.cpp b/libopie2/opieui/otabwidget.cpp
index ec6af9d..f47c90b 100644
--- a/libopie2/opieui/otabwidget.cpp
+++ b/libopie2/opieui/otabwidget.cpp
@@ -29,101 +29,101 @@
29 29
30*/ 30*/
31 31
32#include <opie2/otabwidget.h> 32#include <opie2/otabwidget.h>
33 33
34/* OPIE */ 34/* OPIE */
35#include <qpe/applnk.h> 35#include <qpe/applnk.h>
36#include <qpe/config.h> 36#include <qpe/config.h>
37#include <qpe/resource.h> 37#include <qpe/resource.h>
38#include <opie2/otabbar.h> 38#include <opie2/otabbar.h>
39 39
40/* QT */ 40/* QT */
41#include <qcombobox.h> 41#include <qcombobox.h>
42#include <qwidgetstack.h> 42#include <qwidgetstack.h>
43 43
44using namespace Opie; 44using namespace Opie;
45 45
46OTabWidget::OTabWidget( QWidget *parent, const char *name, TabStyle s, TabPosition p ) 46OTabWidget::OTabWidget( QWidget *parent, const char *name, TabStyle s, TabPosition p )
47 : QWidget( parent, name ) 47 : QWidget( parent, name )
48{ 48{
49 if ( s == Global ) 49 if ( s == Global )
50 { 50 {
51 Config config( "qpe" ); 51 Config config( "qpe" );
52 config.setGroup( "Appearance" ); 52 config.setGroup( "Appearance" );
53 s = ( TabStyle ) config.readNumEntry( "TabStyle", (int) IconTab ); 53 s = ( TabStyle ) config.readNumEntry( "TabStyle", (int) IconTab );
54 if ( s <= Global || s > IconList) 54 if ( s <= Global || s > IconList)
55 { 55 {
56 s = IconTab; 56 s = IconTab;
57 } 57 }
58 QString pos = config.readEntry( "TabPosition", "Top"); 58 QString pos = config.readEntry( "TabPosition", "Top");
59 if ( pos == "Bottom" ) 59 if ( pos == "Bottom" )
60 { 60 {
61 p = Bottom; 61 p = Bottom;
62 } 62 }
63 else 63 else
64 { 64 {
65 p = Top; 65 p = Top;
66 } 66 }
67 } 67 }
68 68
69 widgetStack = new QWidgetStack( this, "widgetstack" ); 69 widgetStack = new QWidgetStack( this, "widgetstack" );
70 widgetStack->setFrameStyle( QFrame::NoFrame ); 70 widgetStack->setFrameStyle( QFrame::NoFrame );
71 widgetStack->setLineWidth( style().defaultFrameWidth() ); 71 widgetStack->setLineWidth( style().defaultFrameWidth() );
72 72
73 tabBarStack = new QWidgetStack( this, "tabbarstack" ); 73 tabBarStack = new QWidgetStack( this, "tabbarstack" );
74 74
75 tabBar = new OTabBar( tabBarStack, "tabbar" ); 75 tabBar = new OTabBar( tabBarStack, "tabbar" );
76 tabBarStack->addWidget( tabBar, 0 ); 76 tabBarStack->addWidget( tabBar, 0 );
77 connect( tabBar, SIGNAL( selected( int ) ), this, SLOT( slotTabBarSelected( int ) ) ); 77 connect( tabBar, SIGNAL( selected(int) ), this, SLOT( slotTabBarSelected(int) ) );
78 78
79 tabList = new QComboBox( false, tabBarStack, "tablist" ); 79 tabList = new QComboBox( false, tabBarStack, "tablist" );
80 tabBarStack->addWidget( tabList, 1 ); 80 tabBarStack->addWidget( tabList, 1 );
81 connect( tabList, SIGNAL( activated( int ) ), this, SLOT( slotTabListSelected( int ) ) ); 81 connect( tabList, SIGNAL( activated(int) ), this, SLOT( slotTabListSelected(int) ) );
82 82
83 tabBarPosition = p; 83 tabBarPosition = p;
84 setTabStyle( s ); 84 setTabStyle( s );
85 setTabPosition( p ); 85 setTabPosition( p );
86 86
87 currTab= 0x0; 87 currTab= 0x0;
88} 88}
89 89
90OTabWidget::~OTabWidget() 90OTabWidget::~OTabWidget()
91{} 91{}
92 92
93void OTabWidget::addTab( QWidget *child, const QString &icon, const QString &label ) 93void OTabWidget::addTab( QWidget *child, const QString &icon, const QString &label )
94{ 94{
95 QPixmap iconset = loadSmooth( icon ); 95 QPixmap iconset = loadSmooth( icon );
96 96
97 QTab *tab = new QTab(); 97 QTab *tab = new QTab();
98 if ( tabBarStyle == IconTab ) 98 if ( tabBarStyle == IconTab )
99 { 99 {
100 tab->label = QString::null; 100 tab->label = QString::null;
101 } 101 }
102 else 102 else
103 { 103 {
104 tab->label = label; 104 tab->label = label;
105 } 105 }
106 if ( tabBarStyle == IconTab || tabBarStyle == IconList ) 106 if ( tabBarStyle == IconTab || tabBarStyle == IconList )
107 { 107 {
108 tab->iconset = new QIconSet( iconset ); 108 tab->iconset = new QIconSet( iconset );
109 } 109 }
110 int tabid = tabBar->addTab( tab ); 110 int tabid = tabBar->addTab( tab );
111 111
112 if ( tabBarStyle == IconTab || tabBarStyle == IconList ) 112 if ( tabBarStyle == IconTab || tabBarStyle == IconList )
113 { 113 {
114 tabList->insertItem( iconset, label, -1 ); 114 tabList->insertItem( iconset, label, -1 );
115 } 115 }
116 else 116 else
117 { 117 {
118 tabList->insertItem( label ); 118 tabList->insertItem( label );
119 } 119 }
120 120
121 widgetStack->addWidget( child, tabid ); 121 widgetStack->addWidget( child, tabid );
122 widgetStack->raiseWidget( child ); 122 widgetStack->raiseWidget( child );
123 widgetStack->setFrameStyle( QFrame::StyledPanel | QFrame::Raised ); 123 widgetStack->setFrameStyle( QFrame::StyledPanel | QFrame::Raised );
124 124
125 OTabInfo *tabinfo = new OTabInfo( tabid, child, icon, label ); 125 OTabInfo *tabinfo = new OTabInfo( tabid, child, icon, label );
126 tabs.append( tabinfo ); 126 tabs.append( tabinfo );
127 selectTab( tabinfo ); 127 selectTab( tabinfo );
128} 128}
129 129
diff --git a/libopie2/opieui/otimepicker.cpp b/libopie2/opieui/otimepicker.cpp
index d4712a4..66f9ce0 100644
--- a/libopie2/opieui/otimepicker.cpp
+++ b/libopie2/opieui/otimepicker.cpp
@@ -176,102 +176,102 @@ void OTimePicker::setTime( int h, int m )
176 * @param m minutes 176 * @param m minutes
177 */ 177 */
178void OTimePicker::setMinute(int m) 178void OTimePicker::setMinute(int m)
179{ 179{
180 180
181 QString minute; 181 QString minute;
182 minute.sprintf("%.2d",m); 182 minute.sprintf("%.2d",m);
183 183
184 QValueListIterator<OClickableLabel *> it; 184 QValueListIterator<OClickableLabel *> it;
185 for (it=minuteLst.begin(); it!=minuteLst.end(); it++) 185 for (it=minuteLst.begin(); it!=minuteLst.end(); it++)
186 { 186 {
187 if ((*it)->text() == minute) (*it)->setOn(true); 187 if ((*it)->text() == minute) (*it)->setOn(true);
188 else (*it)->setOn(false); 188 else (*it)->setOn(false);
189 } 189 }
190 190
191 tm.setHMS(tm.hour(),m,0); 191 tm.setHMS(tm.hour(),m,0);
192} 192}
193 193
194/** 194/**
195 * Method to set the hour 195 * Method to set the hour
196 */ 196 */
197void OTimePicker::setHour(int h) 197void OTimePicker::setHour(int h)
198{ 198{
199 199
200 QString hour; 200 QString hour;
201 hour.sprintf("%.2d",h); 201 hour.sprintf("%.2d",h);
202 202
203 QValueListIterator<OClickableLabel *> it; 203 QValueListIterator<OClickableLabel *> it;
204 for (it=hourLst.begin(); it!=hourLst.end(); it++) 204 for (it=hourLst.begin(); it!=hourLst.end(); it++)
205 { 205 {
206 if ((*it)->text() == hour) (*it)->setOn(true); 206 if ((*it)->text() == hour) (*it)->setOn(true);
207 else (*it)->setOn(false); 207 else (*it)->setOn(false);
208 } 208 }
209 tm.setHMS(h,tm.minute(),0); 209 tm.setHMS(h,tm.minute(),0);
210} 210}
211 211
212 212
213/** 213/**
214 * This is a modal Dialog. 214 * This is a modal Dialog.
215 * 215 *
216 * @param parent The parent widget 216 * @param parent The parent widget
217 * @param name The name of the object 217 * @param name The name of the object
218 * @param fl Possible window flags 218 * @param fl Possible window flags
219 */ 219 */
220OTimePickerDialog::OTimePickerDialog ( QWidget* parent, const char* name, WFlags fl ) 220OTimePickerDialog::OTimePickerDialog ( QWidget* parent, const char* name, WFlags fl )
221 : OTimePickerDialogBase (parent , name, true , fl) 221 : OTimePickerDialogBase (parent , name, true , fl)
222{ 222{
223 223
224 connect ( m_timePicker, SIGNAL( timeChanged( const QTime& ) ), 224 connect ( m_timePicker, SIGNAL( timeChanged(const QTime&) ),
225 this, SLOT( setTime ( const QTime& ) ) ); 225 this, SLOT( setTime(const QTime&) ) );
226 connect ( minuteField, SIGNAL( textChanged ( const QString& ) ), 226 connect ( minuteField, SIGNAL( textChanged(const QString&) ),
227 this, SLOT ( setMinute ( const QString& ) ) ); 227 this, SLOT ( setMinute(const QString&) ) );
228 connect ( hourField, SIGNAL( textChanged ( const QString& ) ), 228 connect ( hourField, SIGNAL( textChanged(const QString&) ),
229 this, SLOT ( setHour ( const QString& ) ) ); 229 this, SLOT ( setHour(const QString&) ) );
230 230
231} 231}
232 232
233/** 233/**
234 * @return the time 234 * @return the time
235 */ 235 */
236QTime OTimePickerDialog::time()const 236QTime OTimePickerDialog::time()const
237{ 237{
238 return m_time; 238 return m_time;
239} 239}
240 240
241/** 241/**
242 * Set the time to time 242 * Set the time to time
243 * @param time The time to be set 243 * @param time The time to be set
244 */ 244 */
245void OTimePickerDialog::setTime( const QTime& time ) 245void OTimePickerDialog::setTime( const QTime& time )
246{ 246{
247 m_time = time; 247 m_time = time;
248 248
249 m_timePicker->setHour ( time.hour() ); 249 m_timePicker->setHour ( time.hour() );
250 m_timePicker->setMinute( time.minute() ); 250 m_timePicker->setMinute( time.minute() );
251 251
252 // Set Textfields 252 // Set Textfields
253 if ( time.hour() < 10 ) 253 if ( time.hour() < 10 )
254 hourField->setText( "0" + QString::number( time.hour() ) ); 254 hourField->setText( "0" + QString::number( time.hour() ) );
255 else 255 else
256 hourField->setText( QString::number( time.hour() ) ); 256 hourField->setText( QString::number( time.hour() ) );
257 257
258 if ( time.minute() < 10 ) 258 if ( time.minute() < 10 )
259 minuteField->setText( "0" + QString::number( time.minute() ) ); 259 minuteField->setText( "0" + QString::number( time.minute() ) );
260 else 260 else
261 minuteField->setText( QString::number( time.minute() ) ); 261 minuteField->setText( QString::number( time.minute() ) );
262 262
263} 263}
264 264
265/** 265/**
266 * This method takes the current minute and tries to set hour 266 * This method takes the current minute and tries to set hour
267 * to hour. This succeeds if the resulting date is valid 267 * to hour. This succeeds if the resulting date is valid
268 * @param hour The hour as a string 268 * @param hour The hour as a string
269 */ 269 */
270void OTimePickerDialog::setHour ( const QString& hour ) 270void OTimePickerDialog::setHour ( const QString& hour )
271{ 271{
272 if ( QTime::isValid ( hour.toInt(), m_time.minute() , 00 ) ) 272 if ( QTime::isValid ( hour.toInt(), m_time.minute() , 00 ) )
273 { 273 {
274 m_time.setHMS ( hour.toInt(), m_time.minute() , 00 ); 274 m_time.setHMS ( hour.toInt(), m_time.minute() , 00 );
275 setTime ( m_time ); 275 setTime ( m_time );
276 } 276 }
277 277
diff --git a/libopie2/opieui/oversatileview.cpp b/libopie2/opieui/oversatileview.cpp
index 8839456..78154b7 100644
--- a/libopie2/opieui/oversatileview.cpp
+++ b/libopie2/opieui/oversatileview.cpp
@@ -125,142 +125,142 @@ OVersatileView::OVersatileView( QWidget* parent, const char* name, int mode )
125 125
126 _listview = new OListView( this, "oversatileview embedded listview" ); 126 _listview = new OListView( this, "oversatileview embedded listview" );
127 _iconview = new QIconView( this, "oversatileview embedded iconview" ); 127 _iconview = new QIconView( this, "oversatileview embedded iconview" );
128 128
129 _listview->setAllColumnsShowFocus( true ); 129 _listview->setAllColumnsShowFocus( true );
130 _listview->setRootIsDecorated( true ); 130 _listview->setRootIsDecorated( true );
131 _listview->setShowSortIndicator( true ); 131 _listview->setShowSortIndicator( true );
132 _iconview->setGridX( 90 ); 132 _iconview->setGridX( 90 );
133 _iconview->setGridY( 42 ); 133 _iconview->setGridY( 42 );
134 _iconview->setAutoArrange( true ); 134 _iconview->setAutoArrange( true );
135 135
136 #ifdef QWS // TODO: Let this depend on current geometry (rotation) 136 #ifdef QWS // TODO: Let this depend on current geometry (rotation)
137 _iconview->setArrangement( QIconView::TopToBottom ); 137 _iconview->setArrangement( QIconView::TopToBottom );
138 #else 138 #else
139 _iconview->setArrangement( QIconView::LeftToRight ); 139 _iconview->setArrangement( QIconView::LeftToRight );
140 #endif 140 #endif
141 141
142 _iconview->setResizeMode( QIconView::Adjust ); 142 _iconview->setResizeMode( QIconView::Adjust );
143 143
144 // qt-embedded: map stylus right on hold to right button press 144 // qt-embedded: map stylus right on hold to right button press
145 145
146 #ifdef QWS 146 #ifdef QWS
147 ( (QPEApplication*) qApp)->setStylusOperation( _iconview->viewport(), QPEApplication::RightOnHold ); 147 ( (QPEApplication*) qApp)->setStylusOperation( _iconview->viewport(), QPEApplication::RightOnHold );
148 ( (QPEApplication*) qApp)->setStylusOperation( _listview->viewport(), QPEApplication::RightOnHold ); 148 ( (QPEApplication*) qApp)->setStylusOperation( _listview->viewport(), QPEApplication::RightOnHold );
149 #endif 149 #endif
150 150
151 setViewMode( mode ); // TODO: Read last style from config 151 setViewMode( mode ); // TODO: Read last style from config
152 // setSynchronization( true ); // TODO: Implement this 152 // setSynchronization( true ); // TODO: Implement this
153 153
154 // create context menu allowing to switch between the views 154 // create context menu allowing to switch between the views
155 155
156 _contextmenu = new QPopupMenu( 0, "oversatileview contextmenu" ); 156 _contextmenu = new QPopupMenu( 0, "oversatileview contextmenu" );
157 _contextmenu->setCaption( "Style" ); 157 _contextmenu->setCaption( "Style" );
158 _contextmenu->setCheckable( true ); 158 _contextmenu->setCheckable( true );
159 QActionGroup* ag = new QActionGroup( _contextmenu, "style option group" ); 159 QActionGroup* ag = new QActionGroup( _contextmenu, "style option group" );
160 QAction* a1 = new QAction( "View Items in Icon Style", QIconSet( QPixmap( view_icon_xpm ) ), 160 QAction* a1 = new QAction( "View Items in Icon Style", QIconSet( QPixmap( view_icon_xpm ) ),
161 "View Icons", 0, ag, "viewicon action", true ); 161 "View Icons", 0, ag, "viewicon action", true );
162 QAction* a2 = new QAction( "View Items in Tree Style", QIconSet( QPixmap( view_tree_xpm ) ), 162 QAction* a2 = new QAction( "View Items in Tree Style", QIconSet( QPixmap( view_tree_xpm ) ),
163 "View Tree", 0, ag, "viewtree action", true ); 163 "View Tree", 0, ag, "viewtree action", true );
164 ag->addTo( _contextmenu ); 164 ag->addTo( _contextmenu );
165 if ( mode == Icons ) 165 if ( mode == Icons )
166 a1->setOn( true ); 166 a1->setOn( true );
167 else if ( mode == Tree ) 167 else if ( mode == Tree )
168 a2->setOn( true ); 168 a2->setOn( true );
169 connect( a1, SIGNAL( activated() ), this, SLOT( setIconViewMode() ) ); 169 connect( a1, SIGNAL( activated() ), this, SLOT( setIconViewMode() ) );
170 connect( a2, SIGNAL( activated() ), this, SLOT( setTreeViewMode() ) ); 170 connect( a2, SIGNAL( activated() ), this, SLOT( setTreeViewMode() ) );
171 171
172 #if (QT_VERSION >= 0x030000) 172 #if (QT_VERSION >= 0x030000)
173 connect( _listview, SIGNAL( contextMenuRequested( QListViewItem*, const QPoint&, int ) ), this, SLOT( contextMenuRequested( QListViewItem*, const QPoint&, int ) ) ); 173 connect( _listview, SIGNAL( contextMenuRequested(QListViewItem*,const QPoint&,int) ), this, SLOT( contextMenuRequested(QListViewItem*,const QPoint&,int) ) );
174 connect( _iconview, SIGNAL( contextMenuRequested( QIconViewItem*, const QPoint& ) ), this, SLOT( contextMenuRequested( QIconViewItem*, const QPoint& ) ) ); 174 connect( _iconview, SIGNAL( contextMenuRequested(QIconViewItem*,const QPoint&) ), this, SLOT( contextMenuRequested(QIconViewItem*,const QPoint&) ) );
175 #else 175 #else
176 connect( _listview, SIGNAL( rightButtonPressed( QListViewItem*, const QPoint&, int ) ), this, SLOT( contextMenuRequested( QListViewItem*, const QPoint&, int ) ) ); 176 connect( _listview, SIGNAL( rightButtonPressed(QListViewItem*,const QPoint&,int) ), this, SLOT( contextMenuRequested(QListViewItem*,const QPoint&,int) ) );
177 connect( _iconview, SIGNAL( rightButtonPressed( QIconViewItem*, const QPoint& ) ), this, SLOT( contextMenuRequested( QIconViewItem*, const QPoint& ) ) ); 177 connect( _iconview, SIGNAL( rightButtonPressed(QIconViewItem*,const QPoint&) ), this, SLOT( contextMenuRequested(QIconViewItem*,const QPoint&) ) );
178 #endif 178 #endif
179 179
180 // 180 //
181 // signal forwarders 181 // signal forwarders
182 // 182 //
183 // unfortunately we can't short-circuit all the QListView and QIconView signals 183 // unfortunately we can't short-circuit all the QListView and QIconView signals
184 // to OVersatileView signals, because the signal/slot mechanism doesn't allow 184 // to OVersatileView signals, because the signal/slot mechanism doesn't allow
185 // type-conversion :-( 185 // type-conversion :-(
186 186
187 // common signals for listview 187 // common signals for listview
188 188
189 connect( _listview, SIGNAL( selectionChanged() ), this, SIGNAL( selectionChanged() ) ); 189 connect( _listview, SIGNAL( selectionChanged() ), this, SIGNAL( selectionChanged() ) );
190 connect( _listview, SIGNAL( selectionChanged( QListViewItem * ) ), this, SLOT( selectionChanged( QListViewItem * ) ) ); 190 connect( _listview, SIGNAL( selectionChanged(QListViewItem*) ), this, SLOT( selectionChanged(QListViewItem*) ) );
191 connect( _listview, SIGNAL( currentChanged( QListViewItem * ) ), this, SLOT( currentChanged( QListViewItem * ) ) ); 191 connect( _listview, SIGNAL( currentChanged(QListViewItem*) ), this, SLOT( currentChanged(QListViewItem*) ) );
192 connect( _listview, SIGNAL( clicked( QListViewItem * ) ), this, SLOT( clicked( QListViewItem * ) ) ); 192 connect( _listview, SIGNAL( clicked(QListViewItem*) ), this, SLOT( clicked(QListViewItem*) ) );
193 connect( _listview, SIGNAL( pressed( QListViewItem * ) ), this, SLOT( pressed( QListViewItem * ) ) ); 193 connect( _listview, SIGNAL( pressed(QListViewItem*) ), this, SLOT( pressed(QListViewItem*) ) );
194 194
195 connect( _listview, SIGNAL( doubleClicked( QListViewItem * ) ), this, SLOT( doubleClicked( QListViewItem * ) ) ); 195 connect( _listview, SIGNAL( doubleClicked(QListViewItem*) ), this, SLOT( doubleClicked(QListViewItem*) ) );
196 connect( _listview, SIGNAL( returnPressed( QListViewItem * ) ), this, SLOT( returnPressed( QListViewItem * ) ) ); 196 connect( _listview, SIGNAL( returnPressed(QListViewItem*) ), this, SLOT( returnPressed(QListViewItem*) ) );
197 197
198 connect( _listview, SIGNAL( onItem( QListViewItem * ) ), this, SLOT( onItem( QListViewItem * ) ) ); 198 connect( _listview, SIGNAL( onItem(QListViewItem*) ), this, SLOT( onItem(QListViewItem*) ) );
199 connect( _listview, SIGNAL( onViewport() ), this, SIGNAL( onViewport() ) ); 199 connect( _listview, SIGNAL( onViewport() ), this, SIGNAL( onViewport() ) );
200 200
201 // common signals for iconview 201 // common signals for iconview
202 202
203 connect( _iconview, SIGNAL( selectionChanged() ), this, SIGNAL( selectionChanged() ) ); 203 connect( _iconview, SIGNAL( selectionChanged() ), this, SIGNAL( selectionChanged() ) );
204 connect( _iconview, SIGNAL( selectionChanged( QIconViewItem * ) ), this, SLOT( selectionChanged( QIconViewItem * ) ) ); 204 connect( _iconview, SIGNAL( selectionChanged(QIconViewItem*) ), this, SLOT( selectionChanged(QIconViewItem*) ) );
205 connect( _iconview, SIGNAL( currentChanged( QIconViewItem * ) ), this, SLOT( currentChanged( QIconViewItem * ) ) ); 205 connect( _iconview, SIGNAL( currentChanged(QIconViewItem*) ), this, SLOT( currentChanged(QIconViewItem*) ) );
206 connect( _iconview, SIGNAL( clicked( QIconViewItem * ) ), this, SLOT( clicked( QIconViewItem * ) ) ); 206 connect( _iconview, SIGNAL( clicked(QIconViewItem*) ), this, SLOT( clicked(QIconViewItem*) ) );
207 connect( _iconview, SIGNAL( pressed( QIconViewItem * ) ), this, SLOT( pressed( QIconViewItem * ) ) ); 207 connect( _iconview, SIGNAL( pressed(QIconViewItem*) ), this, SLOT( pressed(QIconViewItem*) ) );
208 208
209 connect( _iconview, SIGNAL( doubleClicked( QIconViewItem * ) ), this, SLOT( doubleClicked( QIconViewItem * ) ) ); 209 connect( _iconview, SIGNAL( doubleClicked(QIconViewItem*) ), this, SLOT( doubleClicked(QIconViewItem*) ) );
210 connect( _iconview, SIGNAL( returnPressed( QIconViewItem * ) ), this, SLOT( returnPressed( QIconViewItem * ) ) ); 210 connect( _iconview, SIGNAL( returnPressed(QIconViewItem*) ), this, SLOT( returnPressed(QIconViewItem*) ) );
211 211
212 connect( _iconview, SIGNAL( onItem( QIconViewItem * ) ), this, SLOT( onItem( QIconViewItem * ) ) ); 212 connect( _iconview, SIGNAL( onItem(QIconViewItem*) ), this, SLOT( onItem(QIconViewItem*) ) );
213 connect( _iconview, SIGNAL( onViewport() ), this, SIGNAL( onViewport() ) ); 213 connect( _iconview, SIGNAL( onViewport() ), this, SIGNAL( onViewport() ) );
214 214
215 // listview only signals 215 // listview only signals
216 216
217 connect( _listview, SIGNAL( expanded( QListViewItem * ) ), this, SLOT( expanded( QListViewItem * ) ) ); 217 connect( _listview, SIGNAL( expanded(QListViewItem*) ), this, SLOT( expanded(QListViewItem*) ) );
218 connect( _listview, SIGNAL( collapsed( QListViewItem * ) ), this, SLOT( collapsed( QListViewItem * ) ) ); 218 connect( _listview, SIGNAL( collapsed(QListViewItem*) ), this, SLOT( collapsed(QListViewItem*) ) );
219 219
220 // iconview only signals 220 // iconview only signals
221 221
222 connect( _iconview, SIGNAL( moved() ), this, SIGNAL( moved() ) ); 222 connect( _iconview, SIGNAL( moved() ), this, SIGNAL( moved() ) );
223} 223}
224 224
225OVersatileView::~OVersatileView() 225OVersatileView::~OVersatileView()
226{ 226{
227} 227}
228 228
229QPopupMenu* OVersatileView::contextMenu() const 229QPopupMenu* OVersatileView::contextMenu() const
230{ 230{
231 return _contextmenu; 231 return _contextmenu;
232} 232}
233 233
234void OVersatileView::contextMenuRequested( QListViewItem* item, const QPoint& pos, int col ) 234void OVersatileView::contextMenuRequested( QListViewItem* item, const QPoint& pos, int col )
235{ 235{
236 // can't use QObject::inherits here, because ListViewItems, beit Q, O or K, 236 // can't use QObject::inherits here, because ListViewItems, beit Q, O or K,
237 // do not inherit from QObject - assuming here the programmer is 237 // do not inherit from QObject - assuming here the programmer is
238 // disciplined enough to only add OVersatileViewItems to an OVersatileView 238 // disciplined enough to only add OVersatileViewItems to an OVersatileView
239 popupContextMenu( static_cast<OVersatileViewItem*>( item ), pos, col ); 239 popupContextMenu( static_cast<OVersatileViewItem*>( item ), pos, col );
240} 240}
241 241
242void OVersatileView::contextMenuRequested( QIconViewItem* item, const QPoint& pos ) 242void OVersatileView::contextMenuRequested( QIconViewItem* item, const QPoint& pos )
243{ 243{
244 // see above 244 // see above
245 popupContextMenu( static_cast<OVersatileViewItem*>( item ), pos, -1 ); 245 popupContextMenu( static_cast<OVersatileViewItem*>( item ), pos, -1 );
246} 246}
247 247
248void OVersatileView::popupContextMenu( OVersatileViewItem* item, const QPoint& pos, int col ) 248void OVersatileView::popupContextMenu( OVersatileViewItem* item, const QPoint& pos, int col )
249{ 249{
250 if ( !item ) 250 if ( !item )
251 _contextmenu->exec( pos ); 251 _contextmenu->exec( pos );
252 else 252 else
253 emit( contextMenuRequested( item, pos, col ) ); 253 emit( contextMenuRequested( item, pos, col ) );
254} 254}
255 255
256void OVersatileView::setSynchronization( bool sync ) 256void OVersatileView::setSynchronization( bool sync )
257{ 257{
258 _synchronization = sync; 258 _synchronization = sync;
259} 259}
260 260
261bool OVersatileView::synchronization() 261bool OVersatileView::synchronization()
262{ 262{
263 return _synchronization; 263 return _synchronization;
264} 264}
265 265
266void OVersatileView::setDefaultPixmaps( int mode, QPixmap& leaf, QPixmap& opened, QPixmap& closed ) 266void OVersatileView::setDefaultPixmaps( int mode, QPixmap& leaf, QPixmap& opened, QPixmap& closed )