summaryrefslogtreecommitdiff
path: root/libopie/ofileselector.cc
Side-by-side diff
Diffstat (limited to 'libopie/ofileselector.cc') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/ofileselector.cc13
1 files changed, 3 insertions, 10 deletions
diff --git a/libopie/ofileselector.cc b/libopie/ofileselector.cc
index 3c3a6c4..b3aacd6 100644
--- a/libopie/ofileselector.cc
+++ b/libopie/ofileselector.cc
@@ -156,70 +156,66 @@ void OFileSelector::setNewVisible( bool visible )
connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ),
this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) );
connect(m_select, SIGNAL(closeMe() ),
this, SIGNAL(closeMe() ) );
//connect to close me and other signals as well
m_stack->addWidget( m_select, NORMAL );
}else{
m_new->show();
}
}
void OFileSelector::setCloseVisible( bool visible )
{
m_shClose = visible;
if( m_selector == NORMAL ){
setNewVisible( m_shNew ); // yeah baby
}else{
m_close->show();
}
}
void OFileSelector::reread()
{
if( m_selector == NORMAL ){
setNewVisible( m_shNew ); // make it a initializeSelector
}else if ( m_selector == EXTENDED || m_selector == EXTENDED_ALL ){
reparse();
//}else{
//;
}
}
const DocLnk *OFileSelector::selected()
{
- if( m_selector == NORMAL ){
- return m_select->selected();
- }else{
DocLnk *lnk = new DocLnk(selectedDocument() );
return lnk;
- }
}
void OFileSelector::setYesCancelVisible( bool show )
{
initializeYes(); // FIXME if YesCancel is not shown we will initialize it to hide it :(
m_shYesNo = show;
if( m_shYesNo )
m_boxOk->show();
else
m_boxOk->hide();
}
void OFileSelector::setToolbarVisible( bool show )
{
m_shTool = show;
initializeListView(); // FIXME see above waste of memory
if(!m_shTool ){
m_location->hide();
m_up->hide();
m_homeButton->hide();
m_docButton->hide();
}else{
m_location->show();
m_up->show();
m_homeButton->show();
m_docButton->show();
}
}
void OFileSelector::setPermissionBarVisible( bool show )
{
m_shPerm = show;
initializePerm();
@@ -297,67 +293,66 @@ bool OFileSelector::cd(const QString &path )
reparse();
return true;
}
void OFileSelector::setSelector(int mode )
{
QString text;
switch( mode ){
case NORMAL:
text = tr("Documents");
break;
case EXTENDED:
text = tr("Files");
break;
case EXTENDED_ALL:
text = tr("All Files");
break;
}
slotViewCheck( text );
}
void OFileSelector::setPopupMenu(QPopupMenu *popup )
{
m_custom = popup;
m_showPopup = true;
}
//void OFileSelector::updateL
QString OFileSelector::selectedName() const
{
QString name;
if( m_selector == NORMAL ){
- const DocLnk *lnk = m_select->selected();
- name = lnk->file();
- delete lnk;
+ DocLnk lnk = m_select->selectedDocument();
+ name = lnk.file();
}else if( m_selector == EXTENDED || m_selector == EXTENDED_ALL ){
if ( m_shLne ) {
name = m_currentDir + "/" +m_edit->text();
}else{
QListViewItem *item = m_View->currentItem();
if( item != 0 )
name = m_currentDir + "/" + item->text( 1 );
}
}else { // installed view
;
}
return name;
}
QStringList OFileSelector::selectedNames()const
{
QStringList list;
if( m_selector == NORMAL ){
list << selectedName();
}else if ( m_selector == EXTENDED || m_selector == EXTENDED_ALL ) {
list << selectedName(); // FIXME implement multiple Selections
}
return list;
}
/** If mode is set to the Dir selection this will return the selected path.
*
*
*/
QString OFileSelector::selectedPath()const
{
QString path;
if( m_selector == NORMAL ){
path = QPEApplication::documentDir();
@@ -372,67 +367,65 @@ QStringList OFileSelector::selectedPaths() const
list << selectedPath();
return list;
}
QString OFileSelector::directory()const
{
if( m_selector == NORMAL )
return QPEApplication::documentDir();
return QDir(m_currentDir).absPath();
}
int OFileSelector::fileCount()
{
int count;
switch( m_selector ){
case NORMAL:
count = m_select->fileCount();
break;
//case CUSTOM:
case EXTENDED:
case EXTENDED_ALL:
default:
count = m_View->childCount();
break;
}
return count;
}
DocLnk OFileSelector::selectedDocument() const
{
DocLnk lnk;
switch( m_selector ){
case NORMAL:{
- const DocLnk *lnk2 = m_select->selected();
- lnk = DocLnk(*lnk2 ); // copy
- delete lnk2;
+ lnk = m_select->selectedDocument();
break;
}
case EXTENDED:
case EXTENDED_ALL:
default:
lnk = DocLnk( selectedName() ); // new DocLnk
break;
}
return lnk;
}
QValueList<DocLnk> OFileSelector::selectedDocuments() const
{
QValueList<DocLnk> docs;
docs.append( selectedDocument() );
return docs;
}
// slots internal
void OFileSelector::slotOk()
{
emit ok();
}
void OFileSelector::slotCancel()
{
emit cancel();
}
void OFileSelector::slotViewCheck(const QString &sel)
{
if( sel == tr("Documents" ) ){
if( m_select == 0 ){