summaryrefslogtreecommitdiff
path: root/libopie2/opieui/fileselector
authoralwin <alwin>2004-03-02 12:14:15 (UTC)
committer alwin <alwin>2004-03-02 12:14:15 (UTC)
commit0d59c780513da78033f4d9040475dee9db0256d4 (patch) (side-by-side diff)
tree503d320b4aa3daae9982082e7b34e3e2c48bdfb7 /libopie2/opieui/fileselector
parenta0981652d61776d70f25980f035748b21339e946 (diff)
downloadopie-0d59c780513da78033f4d9040475dee9db0256d4.zip
opie-0d59c780513da78033f4d9040475dee9db0256d4.tar.gz
opie-0d59c780513da78033f4d9040475dee9db0256d4.tar.bz2
run the optimize_connect script
the whole cvs is tagged with "before_optimize_connect" if there are problems you can check the diff (but it had compiled and run here)
Diffstat (limited to 'libopie2/opieui/fileselector') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opieui/fileselector/ofiledialog.cpp4
-rw-r--r--libopie2/opieui/fileselector/ofileselector.cpp14
2 files changed, 9 insertions, 9 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 )
{
if ( qApp->argc() < 1 )
return;
Config cfg( QFileInfo(qApp->argv()[0]).fileName() );
cfg.setGroup( key );
QFileInfo inf( file );
cfg.writeEntry("LastDir", inf.dirPath( true ) );
}
};
/**
* This constructs a modal dialog
*
* @param caption The caption of the dialog
* @param wid The parent widget
* @param mode The mode of the OFileSelector @see OFileSelector
* @param selector The selector of the OFileSelector
* @param dirName the dir or resource to start from
* @param fileName a proposed or existing filename
* @param mimetypes The mimeTypes
*/
OFileDialog::OFileDialog(const QString &caption,
QWidget *wid, int mode, int selector,
const QString &dirName,
const QString &fileName,
const QMap<QString,QStringList>& mimetypes )
: QDialog( wid, "OFileDialog", true )
{
// QVBoxLayout *lay = new QVBoxLayout(this);
//showMaximized();
QVBoxLayout *lay = new QVBoxLayout(this );
file = new OFileSelector(this , mode, selector,
dirName, fileName,
mimetypes );
lay->addWidget( file );
//lay->addWidget( file );
//showFullScreen();
setCaption( caption.isEmpty() ? tr("FileDialog") : caption );
connect(file, SIGNAL(fileSelected(const QString&) ),
this, SLOT(slotFileSelected(const QString&) ) );
connect(file, SIGNAL(ok() ),
this, SLOT(slotSelectorOk()) ) ;
connect(file, SIGNAL(dirSelected(const QString&) ), this, SLOT(slotDirSelected(const QString&) ) );
#if 0
- connect(file, SIGNAL(dirSelected(const QString &) ),
- this, SLOT(slotDirSelected(const QString &) ) );
+ connect(file, SIGNAL(dirSelected(const QString&) ),
+ this, SLOT(slotDirSelected(const QString&) ) );
#endif
}
/**
* @returns the mimetype of the selected
* currently it return QString::null
*/
QString OFileDialog::mimetype()const
{
return QString::null;
}
/**
* @return the fileName
*/
QString OFileDialog::fileName()const
{
return file->selectedName();
}
/**
* return a DocLnk to the current file
*/
DocLnk OFileDialog::selectedDocument()const
{
return file->selectedDocument();
}
/**
* This opens up a filedialog in Open mode
*
* @param selector the Selector Mode
* @param startDir Where to start from
* @param file A proposed filename
* @param mimes A list of MimeTypes
* @param wid the parent
* @param caption of the dialog if QString::null tr("Open") will be used
* @return the fileName or QString::null
*/
QString OFileDialog::getOpenFileName(int selector,
const QString &_startDir,
const QString &file,
const MimeTypes &mimes,
QWidget *wid,
const QString &caption )
{
QString ret;
QString startDir = _startDir;
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
if (!m_selector)
return QString::null;
return m_selector->selectedDocument().file();
}
QString ODocumentFileView::selectedPath()const
{
return QPEApplication::documentDir();
}
QString ODocumentFileView::directory()const
{
return selectedPath();
}
void ODocumentFileView::reread()
{
if (!m_selector)
return;
m_selector->setNewVisible( showNew() );
m_selector->setCloseVisible( showClose() );
m_selector->filter = currentMimeType().join(";");
m_selector->reread();
}
int ODocumentFileView::fileCount()const
{
if (!m_selector)
return -1;
return m_selector->fileCount();
}
DocLnk ODocumentFileView::selectedDocument()const
{
if (!m_selector)
return DocLnk();
return m_selector->selectedDocument();
}
QWidget* ODocumentFileView::widget( QWidget* parent )
{
if (!m_selector )
{
m_selector = new FileSelector(currentMimeType().join(";"), parent, "fileselector", showNew(), showClose() );
- QObject::connect(m_selector, SIGNAL(fileSelected( const DocLnk& ) ),
+ QObject::connect(m_selector, SIGNAL(fileSelected(const DocLnk&) ),
selector(), SLOT(slotDocLnkBridge(const DocLnk&) ) );
QObject::connect(m_selector, SIGNAL(closeMe() ),
selector(), SIGNAL(closeMe() ) );
- QObject::connect(m_selector, SIGNAL(newSelected(const DocLnk& ) ),
- selector(), SIGNAL(newSelected(const DocLnk& ) ) );
+ QObject::connect(m_selector, SIGNAL(newSelected(const DocLnk&) ),
+ selector(), SIGNAL(newSelected(const DocLnk&) ) );
}
return m_selector;
}
/*
* This is the file system view used
* we use a QListView + QListViewItems for it
*/
OFileSelectorItem::OFileSelectorItem( QListView* view, const QPixmap& pixmap,
const QString& path, const QString& date,
const QString& size, const QString& dir,
bool isLocked, bool isDir )
: QListViewItem( view )
{
setPixmap(0, pixmap );
setText(1, path );
setText(2, size );
setText(3, date );
m_isDir = isDir;
m_dir = dir;
m_locked = isLocked;
}
OFileSelectorItem::~OFileSelectorItem()
{
}
bool OFileSelectorItem::isLocked()const
{
return m_locked;
}
QString OFileSelectorItem::directory()const
{
return m_dir;
}
bool OFileSelectorItem::isDir()const
{
return m_isDir;
}
QString OFileSelectorItem::path()const
{
return text( 1 );
}
@@ -479,98 +479,98 @@ void OFileViewFileListView::reread( bool all )
{ // couldn't resolve symlink add it as symlink
addSymlink( fi );
}
} // off for loop for symlink resolving
}
else if( fi->isDir() )
addDir( fi );
else if( fi->isFile() )
addFile( fi );
++it;
} // of while loop
m_view->sort();
}
int OFileViewFileListView::fileCount()const
{
return m_view->childCount();
}
QString OFileViewFileListView::currentDir()const
{
return m_currentDir;
}
OFileSelector* OFileViewFileListView::selector()
{
return m_sel;
}
bool OFileViewFileListView::eventFilter (QObject *o, QEvent *e)
{
if ( e->type() == QEvent::KeyPress )
{
QKeyEvent *k = (QKeyEvent *)e;
if ( (k->key()==Key_Enter) || (k->key()==Key_Return))
{
slotClicked( Qt::LeftButton,m_view->currentItem(),QPoint(0,0),0);
return true;
}
}
return false;
}
void OFileViewFileListView::connectSlots()
{
connect(m_view, SIGNAL(clicked(QListViewItem*) ),
this, SLOT(slotCurrentChanged(QListViewItem*) ) );
- connect(m_view, SIGNAL(mouseButtonClicked(int, QListViewItem*, const QPoint&, int ) ),
- this, SLOT(slotClicked(int, QListViewItem*, const QPoint&, int ) ) );
+ connect(m_view, SIGNAL(mouseButtonClicked(int,QListViewItem*,const QPoint&,int) ),
+ this, SLOT(slotClicked(int,QListViewItem*,const QPoint&,int) ) );
}
void OFileViewFileListView::slotCurrentChanged( QListViewItem* item)
{
if (!item)
return;
#if 0
OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item);
if (!sel->isDir() )
{
selector()->m_lneEdit->setText( sel->text(1) );
// if in fileselector mode we will emit selected
if ( selector()->mode() == OFileSelector::FileSelector )
{
qWarning("slot Current Changed");
QStringList str = QStringList::split("->", sel->text(1) );
QString path = sel->directory() + "/" + str[0].stripWhiteSpace();
emit selector()->fileSelected( path );
DocLnk lnk( path );
emit selector()->fileSelected( lnk );
}
}
#endif
}
void OFileViewFileListView::slotClicked(int button , QListViewItem* item, const QPoint&, int )
{
if (!item || ( button != Qt::LeftButton) )
return;
OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item);
if (!sel->isLocked() )
{
QStringList str = QStringList::split("->", sel->text(1) );
if (sel->isDir() )
{
m_currentDir = sel->directory() + "/" + str[0].stripWhiteSpace();
emit selector()->dirSelected( m_currentDir );
reread( m_all );
}
else
{ // file
qWarning("slot Clicked");
selector()->m_lneEdit->setText( str[0].stripWhiteSpace() );
QString path = sel->directory() + "/" + str[0].stripWhiteSpace();
emit selector()->fileSelected( path );
@@ -934,98 +934,98 @@ void OFileSelector::initUI()
m_cmbView = new QComboBox( m_cmbBox );
m_cmbMime = new QComboBox( m_cmbBox );
lay->addWidget( m_cmbBox );
}
/*
* This will make sure that the return key in the name edit causes dialogs to close
*/
bool OFileSelector::eventFilter (QObject *o, QEvent *e)
{
if ( e->type() == QEvent::KeyPress )
{
QKeyEvent *k = (QKeyEvent *)e;
if ( (k->key()==Key_Enter) || (k->key()==Key_Return))
{
emit ok();
return true;
}
}
return false;
}
/*
* This will insert the MimeTypes into the Combo Box
* And also connect the changed signal
*
* AutoMimeTyping is disabled for now. It used to reparse a dir and then set available mimetypes
*/
void OFileSelector::initMime()
{
MimeTypes::Iterator it;
for ( it = m_mimeType.begin(); it != m_mimeType.end(); ++it )
{
m_cmbMime->insertItem( it.key() );
}
m_cmbMime->setCurrentItem( 0 );
connect( m_cmbMime, SIGNAL(activated(int) ),
this, SLOT(slotMimeTypeChanged() ) );
}
void OFileSelector::initViews()
{
m_cmbView->insertItem( QObject::tr("Documents") );
m_cmbView->insertItem( QObject::tr("Files") );
m_cmbView->insertItem( QObject::tr("All Files") );
- connect(m_cmbView, SIGNAL(activated( const QString& ) ),
- this, SLOT(slotViewChange( const QString& ) ) );
+ connect(m_cmbView, SIGNAL(activated(const QString&) ),
+ this, SLOT(slotViewChange(const QString&) ) );
m_views.insert( QObject::tr("Documents"), new ODocumentFileView(this) );
/* see above why add both */
OFileViewInterface* in = new OFileViewFileSystem( this );
m_views.insert( QObject::tr("Files"), in );
m_views.insert( QObject::tr("All Files"), in );
}
/**
* d'tor
*/
OFileSelector::~OFileSelector()
{
}
/**
* Convience function for the fileselector
* make sure to delete the DocLnk
*
* @see DocLnk
* @todo remove in ODP
*/
const DocLnk* OFileSelector::selected()
{
DocLnk* lnk = new DocLnk( currentView()->selectedDocument() );
return lnk;
}
/**
*
* @return the name of the selected file
*/
QString OFileSelector::selectedName()const
{
return currentView()->selectedName();
}
/**
* @return the selected path
*/
QString OFileSelector::selectedPath()const
{
return currentView()->selectedPath();