summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/ofileselector.cc36
1 files changed, 30 insertions, 6 deletions
diff --git a/libopie/ofileselector.cc b/libopie/ofileselector.cc
index 98290e0..824acf2 100644
--- a/libopie/ofileselector.cc
+++ b/libopie/ofileselector.cc
@@ -116,25 +116,25 @@ OFileSelector::OFileSelector( QWidget *wid, int mode, int selector,
OFileSelector::OFileSelector(const QString &mimeFilter, QWidget *parent,
const char *name, bool newVisible,
bool closeVisible )
: QWidget( parent, name )
{
if (!mimeFilter.isEmpty() ) {
QStringList list = QStringList::split(";", mimeFilter );
m_mimetypes.insert(mimeFilter, list );
}
initVars();
m_currentDir = QPEApplication::documentDir();
- m_mode = OPEN;
+ m_mode = FILESELECTOR;
m_selector = NORMAL;
m_shClose = closeVisible;
m_shNew = newVisible;
m_shLne = false;
m_shPerm = false;
m_shYesNo = false;
init();
}
OFileSelector::~OFileSelector()
@@ -146,24 +146,26 @@ OFileSelector::~OFileSelector()
void OFileSelector::setNewVisible( bool visible )
{
m_shNew = visible;
if( m_selector == NORMAL ){
delete m_select;
// we need to initialize but keep the selected mimetype
QString mime = currentMimeType();
m_select = new FileSelector( mime ,
m_stack, "fileselector",
m_shNew, m_shClose);
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{
@@ -426,27 +428,29 @@ void OFileSelector::slotCancel()
{
emit cancel();
}
void OFileSelector::slotViewCheck(const QString &sel)
{
if( sel == tr("Documents" ) ){
if( m_select == 0 ){
// autMime? fix cause now we use All and not the current
// yes currentMime fixes that for us
QString mime = currentMimeType();
m_select = new FileSelector(mime,
m_stack, "fileselector",
- FALSE, FALSE);
+ m_shNew, m_shClose);
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 );
}
m_stack->raiseWidget( NORMAL );
m_selector = NORMAL;
}else if( sel == tr("Files") ){
m_selector = EXTENDED;
initializeListView();
reparse();
m_stack->raiseWidget( EXTENDED );
}else if( sel == tr("All Files") ){
@@ -485,28 +489,30 @@ void OFileSelector::slotMimeCheck(const QString &mime)
if (mime != tr("All") ) {
QMap<QString, QStringList>::Iterator it;
it = m_mimetypes.find(mime);
if ( it != m_mimetypes.end() ) {
newMimeType = it.data().join(";");
}else{
newMimeType = mime;
}
}
delete m_select;
m_select = new FileSelector( newMimeType,
m_stack, "fileselector",
- FALSE, FALSE);
+ m_shNew, m_shClose);
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 );
m_stack->raiseWidget( NORMAL );
updateMimes();
updateMimeCheck();
m_mimeCheck->setCurrentItem(indexByString( m_mimeCheck, mime) );
//}
}else{ // others
qWarning("Mime %s", mime.latin1() );
if(m_shChooser ){
qWarning("Current Text %s", m_mimeCheck->currentText().latin1() );
//m_mimeCheck->setCurrentItem(indexByString( m_mimeCheck, mime) );
@@ -551,28 +557,30 @@ void OFileSelector::init()
m_stack = new QWidgetStack( this );
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(";");
}
}
m_select = new FileSelector(mime,
m_stack, "fileselector",
- FALSE, FALSE);
+ m_shNew, m_shClose);
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 );
m_stack->raiseWidget( NORMAL );
}else{ // we're in init so it will be EXTENDED or EXTENDED_ALL
// and initializeListview will take care of those
// toolbar get's generade in initializeListView
initializeListView( ); // will raise the widget as well
m_stack->raiseWidget( EXTENDED );
}
m_lay->addWidget( m_stack, 100 ); // add to the layout 10 = stretch
@@ -865,26 +873,26 @@ void OFileSelector::initializeListView()
int count = m_location->count();
m_location->insertItem( m_currentDir );
m_location->setCurrentItem( count );
// due to the New and Close button we can not simply hide m_boxToolBar to not show it
if( !m_shTool ){
m_location->hide( );
m_up->hide( );
m_homeButton->hide( );
m_docButton->hide( );
}
if(!m_shClose )
m_close->hide();
- if(!m_shNew)
- m_close->hide();
+ //if(!m_shNew)
+ //m_close->hide();
} // off toolbar
// the Main ListView
// make a QWidgetStack first so Views can share the Toolbar
m_View = new QListView( m_pseudo, "Extended view");
QPEApplication::setStylusOperation( m_View->viewport(),
QPEApplication::RightOnHold);
m_View->addColumn(" " );
m_View->addColumn(tr("Name"), 135 );
m_View->addColumn(tr("Size"), -1 );
m_View->addColumn(tr("Date"), 60 );
m_View->addColumn(tr("Mime Type"), -1 );
@@ -1013,27 +1021,36 @@ void OFileSelector::slotFileBridgeSelected( const DocLnk &lnk )
// emit fileSelected( lnk );
}
void OFileSelector::slotSelectionChanged()
{
}
void OFileSelector::slotCurrentChanged(QListViewItem* item )
{
if( item == 0 )
return;
if( m_selector == EXTENDED || m_selector == EXTENDED_ALL ) {
OFileSelectorItem *sel = (OFileSelectorItem*) item; // start to use the C++ casts ;)
+ qWarning("current changed");
if(!sel->isDir() ){
if( m_shLne )
m_edit->setText( sel->text(1) );
+
+ if (m_mode == FILESELECTOR ) {
+ QStringList str = QStringList::split("->", sel->text(1) );
+ QString path =sel->directory() + "/" + str[0].stripWhiteSpace();
+ emit fileSelected(path );
+ DocLnk lnk( path );
+ emit fileSelected(lnk );
+ }
}
}
}
void OFileSelector::slotClicked( int button, QListViewItem *item, const QPoint &, int)
{
if ( item == 0 )
return;
if( button != Qt::LeftButton )
return;
switch( m_selector ){
@@ -1041,25 +1058,29 @@ void OFileSelector::slotClicked( int button, QListViewItem *item, const QPoint &
break;
case EXTENDED: // fall through
case EXTENDED_ALL:{
OFileSelectorItem *sel = (OFileSelectorItem*)item;
if(!sel->isLocked() ){
QStringList str = QStringList::split("->", sel->text(1) );
if( sel->isDir() ){
cd( sel->directory() + "/" + str[0].stripWhiteSpace() );
// if MODE Dir m_shLne set the Text
}else{
if( m_shLne )
m_edit->setText( str[0].stripWhiteSpace() );
+ qWarning("selected here in slot clicked");
emit fileSelected( sel->directory() + "/" + str[0].stripWhiteSpace() );
+ DocLnk lnk( sel->directory() + "/" + str[0].stripWhiteSpace() );
+ qWarning("file selected");
+ emit fileSelected( lnk );
}
}
break;
}
}
}
void OFileSelector::slotRightButton(int button, QListViewItem *item, const QPoint &, int )
{
if( item == 0 )
return;
if( button != Qt::RightButton )
@@ -1075,24 +1096,27 @@ void OFileSelector::slotChangedDir()
OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem();
if(sel->isDir() ){
QStringList str = QStringList::split("->", sel->text(1) );
cd( sel->directory() + "/" + str[0].stripWhiteSpace() );
}
}
void OFileSelector::slotOpen()
{
OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem();
if(!sel->isDir() ){
QStringList str = QStringList::split("->", sel->text(1) );
slotFileSelected( sel->directory() +"/" +str[0].stripWhiteSpace() );
+ qWarning("slot open");
+ // DocLnk lnk( sel->directory() + "/" + str[0].stripWhiteSpace() );
+ //emit fileSelected( lnk );
}
}
void OFileSelector::slotRescan()
{
}
void OFileSelector::slotRename()
{
reparse();
}
void OFileSelector::slotDelete()
{