summaryrefslogtreecommitdiff
path: root/libopie/ofileselector/ofileselector.cpp
Side-by-side diff
Diffstat (limited to 'libopie/ofileselector/ofileselector.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/ofileselector/ofileselector.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/libopie/ofileselector/ofileselector.cpp b/libopie/ofileselector/ofileselector.cpp
index 9ce07dd..c6e923f 100644
--- a/libopie/ofileselector/ofileselector.cpp
+++ b/libopie/ofileselector/ofileselector.cpp
@@ -440,96 +440,98 @@ void OFileSelector::slotInsertLocationPath(const QString &currentPath, int count
* don't try to change dir to a file
*/
void OFileSelector::locationComboChanged()
{
QFileInfo info( m_location->lineEdit()->text() );
qWarning("info %s %s", info.dirPath(true).latin1(), m_location->lineEdit()->text().latin1() );
if (info.isFile() )
cd(info.dirPath(TRUE) ); //absolute path
else
cd( m_location->lineEdit()->text() );
}
void OFileSelector::init()
{
initFactory();
m_lay = new QVBoxLayout( this );
m_lay->setSpacing(0 );
/* take care of the main view... */
initToolbar();
//if( m_shChooser ) // the Chooser for the view and Mimetypes
initializeChooser();
/* initialize the file lister */
if( m_selector == Normal ){
QString mime;
if (!m_autoMime) {
if (!m_mimetypes.isEmpty() ) {
QMap<QString, QStringList>::Iterator it;
it = m_mimetypes.begin(); // cause we're in the init
mime = it.data().join(";");
}
}
initializeOldSelector();
}else{
initializeView();
}
if( m_shLne ) // the LineEdit with the current FileName
initializeName();
if( m_shPerm ) // the Permission QCheckBox
initializePerm();
if( m_shYesNo ) // the Yes No button row
initializeYes( );
if (m_selector != Normal )
reparse();
+
+ showMaximized();
}
void OFileSelector::updateMimes()
{
if( m_autoMime ){
m_mimetypes.clear();
m_mimetypes.insert( tr("All"), QString::null );
if( m_selector == Normal ){
DocLnkSet set;
Global::findDocuments(&set, QString::null );
QListIterator<DocLnk> dit( set.children() );
for( ; dit.current(); ++dit ){
if( !m_mimetypes.contains( (*dit)->type() ) )
m_mimetypes.insert( (*dit)->type(), (*dit)->type() );
}
}// else done in reparse
}
}
void OFileSelector::initVars()
{
if( m_mimetypes.isEmpty() )
m_autoMime = true;
else
m_autoMime = false;
m_shClose = false;
m_shNew = false;
m_shTool = true;
m_shPerm = false;
m_shLne = true;
m_shChooser = true;
m_shYesNo = true;
m_case = false;
m_dir = true;
m_files = true;
m_showPopup = false;
m_mainView = 0l;
m_fileView = 0l;
m_lister = 0l;
if(m_pixmaps == 0 ) // init the pixmaps
initPics();
// pointers
m_location = 0;
m_mimeCheck = 0;
m_viewCheck = 0;
m_homeButton = 0;
m_docButton = 0;
@@ -606,97 +608,97 @@ void OFileSelector::initializeYes()
* out that combobox
* if automime we need to update the mimetypes
*/
void OFileSelector::updateMimeCheck() {
m_mimeCheck->clear();
if (m_autoMime ) {
//m_mimeCheck->insertItem( tr("All") );
updateMimes();
}
QMap<QString, QStringList>::Iterator it;
for (it = m_mimetypes.begin(); it != m_mimetypes.end(); ++it ) {
m_mimeCheck->insertItem( it.key() );
}
}
void OFileSelector::initializeChooser()
{
if( m_boxView == 0 ){
m_boxView = new QHBox( this );
m_viewCheck = new QComboBox( m_boxView, "view check");
m_mimeCheck = new QComboBox( m_boxView, "mime check");
m_boxView->setSpacing( 8 );
m_lay->addWidget(m_boxView, 0 );
updateMimeCheck();
fillList();
connect( m_viewCheck, SIGNAL( activated(const QString & ) ),
this, SLOT( slotViewCheck(const QString & ) ) );
connect( m_mimeCheck, SIGNAL( activated(const QString & ) ),
this, SLOT( slotMimeCheck( const QString & ) ) );
}
}
/* generate the buttons for the toolbar */
void OFileSelector::initToolbar() {
m_mainView = new OFileSelectorMain( this );
/* now generate the tool bar */
qWarning( "toolbar" );
m_pseudo = new QWidget( m_mainView, "Pseudo Widget" );
m_pseudoLayout = new QVBoxLayout( m_pseudo );
m_boxToolbar = new QHBox( m_pseudo );
m_boxToolbar->setSpacing( 0 );
// tool bar members now
- m_location = new QComboBox( m_boxToolbar );
+ m_location = new QComboBox( m_boxToolbar );
m_location->setEditable( TRUE );
m_location->setDuplicatesEnabled( FALSE );
connect( m_location, SIGNAL(activated(const QString& ) ),
this, SLOT(slotLocationActivated(const QString& )) );
connect( m_location->lineEdit(), SIGNAL(returnPressed() ) ,
this, SLOT(locationComboChanged() ) );
// UP Button
m_up = new QPushButton( Resource::loadIconSet("up"), QString::null,
m_boxToolbar, "cdUpButton" );
m_up->setFixedSize( QSize(20, 20 ) );
connect( m_up, SIGNAL( clicked() ), this, SLOT(cdUP() ) );
m_up->setFlat( TRUE );
// Home Button
m_homeButton = new QPushButton(Resource::loadIconSet("home"),
QString::null, m_boxToolbar );
m_homeButton->setFixedSize( QSize(20, 20 ) );
connect(m_homeButton, SIGNAL(clicked() ), this, SLOT(slotHome() ) );
m_homeButton->setFlat( TRUE );
// Documents Button
m_docButton = new QPushButton( Resource::loadIconSet("DocsIcon"),
QString::null, m_boxToolbar,
"docsButton" );
m_docButton->setFixedSize( QSize(20, 20 ) );
m_docButton->setFlat( true );
connect( m_docButton, SIGNAL(clicked() ),
this, SLOT(slotDoc() ) );
// close button
m_close = new QPushButton( Resource::loadIconSet( "close"), "",
m_boxToolbar );
connect( m_close, SIGNAL(clicked() ), this, SIGNAL(closeMe() ) );
m_close->setFixedSize( 20, 20 );
m_boxToolbar->setFixedHeight( 20 );
m_pseudoLayout->addWidget(m_boxToolbar );
/* init the locations */
initLocations();
if( !m_shTool ){
m_location->hide( );
m_up->hide( );
m_homeButton->hide( );
m_docButton->hide( );
}
@@ -929,99 +931,99 @@ void OFileSelector::setLister(const QString& lister) {
/*
* if we do not have a lister
* we need to take the default one
*/
m_lister = new OLocalLister(this);
}
m_listerName = lister;
}
void OFileSelector::setView( const QString& lis ) {
qWarning("setView ");
fillList();
if ( lis == tr("Documents") ) {
m_selector = Normal;
delete m_lister;
delete m_fileView;
m_lister = 0l;
m_fileView = 0l;
initializeOldSelector();
}else {
qWarning("lis %s", lis.latin1() );
QString list;
delete m_lister;
delete m_fileView;
delete m_select;
m_lister =0l;
m_fileView = 0l;
m_select = 0l;
if ( lis.startsWith("All") ) {
m_selector = ExtendedAll;
list = lis.mid(4 ).stripWhiteSpace();
} else{
list = lis;
m_selector = Extended;
}
setLister(m_listerName);
m_fileView = factory()->view( list, this, m_mainView );
m_mainView->setWidget( m_fileView->widget() );
reparse();
}
}
/*
* the factory
*/
void OFileSelector::initFactory() {
m_fileFactory = new OFileFactory();
m_fileFactory->addLister(tr("Files"), newLocalLister );
m_fileFactory->addView(tr("List View"), newFileListView );
- /* the factory is just a dummy */
- m_fileFactory->addView(tr("Documents"), newFileListView );
+ m_fileFactory->addView(tr("Documents"), newFileIconView );
}
+
void OFileSelector::fillList() {
qWarning("fill list");
if (!m_viewCheck )
return;
m_viewCheck->clear();
QStringList list = factory()->views();
qWarning("views: " + list.join(";") );
for (QStringList::Iterator it = list.begin(); it != list.end(); ++it ) {
qWarning( (*it) );
if ( (*it) == tr("Documents") ) {
m_viewCheck->insertItem( (*it) );
}else{
m_viewCheck->insertItem( (*it) );
m_viewCheck->insertItem( tr("All ") + (*it) );
}
}
}
OFileFactory* OFileSelector::factory() {
return m_fileFactory;
}
OFileView* OFileSelector::currentView() {
return m_fileView;
}
OFileView* OFileSelector::currentView() const{
return m_fileView;
}
int OFileSelector::filter() {
int filter;
if ( m_selector == ExtendedAll )
filter = QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All;
else
filter = QDir::Files | QDir::Dirs | QDir::All ;
return filter;
}
int OFileSelector::sorting() {
int sort;
if (m_case )
sort = ( QDir::IgnoreCase | QDir::Name | QDir::DirsFirst | QDir::Reversed );
else
sort = ( QDir::Name | QDir::DirsFirst | QDir::Reversed );
return sort;
}