author | zecke <zecke> | 2002-04-12 13:24:38 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-04-12 13:24:38 (UTC) |
commit | e3443eef4d49c7e91369790c29dd3b15b5dba854 (patch) (side-by-side diff) | |
tree | b92f78798a247ecf3eec501c64f5f8c81dc043fe | |
parent | 3973cf42c778055ab81a9ee254eaf8829464f936 (diff) | |
download | opie-e3443eef4d49c7e91369790c29dd3b15b5dba854.zip opie-e3443eef4d49c7e91369790c29dd3b15b5dba854.tar.gz opie-e3443eef4d49c7e91369790c29dd3b15b5dba854.tar.bz2 |
fix the crash
-rw-r--r-- | libopie/TODO | 1 | ||||
-rw-r--r-- | libopie/ofileselector.cc | 10 |
2 files changed, 6 insertions, 5 deletions
diff --git a/libopie/TODO b/libopie/TODO index a4e1ada..d49910c 100644 --- a/libopie/TODO +++ b/libopie/TODO @@ -1,19 +1,20 @@ - xmltree done - tododb - set Alarms - multiple categories - Attendees - OFileSelector + - fix the weird view change bug delete m_pseudoLayout crash - DocLnk when not in Document Mode ( and vice versa ) - MultipleDocuments - TreeView have a own OFileSelectorItem for this - IconView add a QIconView to the widgetstack - Move OFileSelectorItem to it's own files - add functions to access the member variables - debug - new Dirs created inside the listview - Clickable labels? Harlekin you wanted them in the libs?
\ No newline at end of file diff --git a/libopie/ofileselector.cc b/libopie/ofileselector.cc index 7451c1b..968541a 100644 --- a/libopie/ofileselector.cc +++ b/libopie/ofileselector.cc @@ -471,338 +471,338 @@ void OFileSelector::reparse() if( !info.exists() ){ qWarning("does not exist" ); addSymlink(currMime, fi, TRUE ); break; }else if( info.isDir() ){ qWarning("isDir" ); addDir(currMime, fi, TRUE ); break; }else if( info.isFile() ){ qWarning("isFile" ); addFile(currMime, fi, TRUE ); break; }else if( info.isSymLink() ){ file = info.dirPath(true)+ "/"+ info.readLink(); qWarning("isSymlink again %s", file.latin1() ); }else if( i == 4 ){ // just insert it and have the symlink symbol addSymlink(currMime, fi ); qWarning("level too deep" ); } } }else if( fi->isDir() ){ addDir(currMime, fi ); }else if( fi->isFile() ) { // file ? addFile(currMime, fi ); } ++it; } m_View->sort(); } QString OFileSelector::directory()const { return m_currentDir; } int OFileSelector::fileCount() { return 0; } void OFileSelector::slotOk( ) { emit ok(); } void OFileSelector::slotCancel( ) { emit cancel(); } void OFileSelector::initializeName() { m_boxName = new QHBoxLayout(this ); m_edit = new QLineEdit(this ); m_fnLabel = new QLabel(this ); m_fnLabel->setText(tr("Name:") ); m_boxName->addWidget(m_fnLabel ); m_boxName->insertSpacing(1, 8 ); m_boxName->addWidget(m_edit, 100 ); m_lay->addLayout(m_boxName); } void OFileSelector::initializeYes() { m_ok = new QPushButton("&Save", this, "save" ); m_cancel = new QPushButton("C&ancel", this, "cancel" ); m_boxOk = new QHBoxLayout(this ); m_boxOk->addWidget( m_ok, Qt::AlignHCenter ); m_boxOk->insertSpacing(1, 8 ); m_boxOk->addWidget( m_cancel, Qt::AlignHCenter); m_lay->addLayout(m_boxOk ); connect(m_ok, SIGNAL(clicked() ), this, SLOT(slotOk() ) ); connect(m_cancel, SIGNAL(clicked() ), this, SLOT(slotCancel() ) ); } void OFileSelector::initializeChooser() { m_boxView = new QHBoxLayout(this ); m_mimeCheck = new QComboBox(this, "mime check"); m_viewCheck = new QComboBox(this, "view check"); m_boxView->addWidget(m_viewCheck, 0 ); m_boxView->insertSpacing(1, 8 ); m_boxView->addWidget(m_mimeCheck, 0 ); m_lay->addLayout(m_boxView ); m_viewCheck->insertItem(tr("Documents") ); m_viewCheck->insertItem(tr("Files") ); m_viewCheck->insertItem(tr("All Files") ); if(!m_autoMime ) m_mimeCheck->insertItem(m_mimetypes.join("," ) ); else{ // check updateMimes(); m_mimeCheck->insertStringList( m_mimetypes ); } connect( m_viewCheck, SIGNAL(activated(const QString &) ), this, SLOT(slotViewCheck(const QString & ) ) ); connect( m_mimeCheck, SIGNAL(activated(const QString &) ), this, SLOT(slotMimeCheck(const QString & ) ) ); } void OFileSelector::slotMimeCheck(const QString &view ){ if(m_selector == NORMAL ){ delete m_select; m_select = new FileSelector(view == "All" ? QString::null : view , m_stack, "fileselector", FALSE, FALSE ); m_stack->addWidget( m_select, NORMAL ); m_stack->raiseWidget( NORMAL ); }else{ reparse(); } } void OFileSelector::slotViewCheck(const QString &view ){ qWarning("changed: show %s", view.latin1() ); // if the current view is the one QString currMime = m_mimeCheck->currentText(); if( view == QString::fromLatin1("Documents") ){ // get the mimetype now // check if we're the current widget and return if( m_View != 0) { // delete 0 shouldn't crash but it did :( delete m_View; delete m_boxToolbar; delete m_homeButton; delete m_docButton; delete m_location; delete m_up; delete m_pseudo; - if(m_pseudoLayout!=0 ) - delete m_pseudoLayout; + //if(m_pseudoLayout!=0 ) +// delete m_pseudoLayout; } m_View = 0; m_boxToolbar = 0; m_homeButton = 0; m_docButton = 0; m_location = 0; m_up = 0; m_pseudo = 0; m_pseudoLayout = 0; delete m_select; m_select = new FileSelector( currMime == "All" ? QString::null : currMime, m_stack,"fileselector", FALSE, FALSE ); m_stack->addWidget( m_select, NORMAL ); m_mimeCheck->clear(); m_selector = NORMAL; updateMimes(); m_mimeCheck->insertStringList( m_mimetypes ); m_stack->raiseWidget( NORMAL ); connect(m_select, SIGNAL(fileSelected( const DocLnk &) ), this, SLOT(slotFileBridgeSelected(const DocLnk &) ) ); }else if(view == QString::fromLatin1("Files") ){ // remove from the stack delete m_select; m_select = 0; delete m_View; m_View = 0; m_selector = EXTENDED; // create the ListView or IconView initializeListView(); reparse(); }else if(view == QString::fromLatin1("All Files") ) { // remove from the stack delete m_select; m_select = 0; delete m_View; m_View = 0; m_selector = EXTENDED_ALL; initializeListView(); reparse(); }; }; void OFileSelector::updateMimes() // lets check which mode is active // check the current dir for items then { m_mimetypes.clear(); m_mimetypes.append("All" ); 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.append( (*dit)->type() ); } }else{ // should be allreday updatet ; } }; void OFileSelector::initializeListView() { // just to make sure but clean it up better FIXME delete m_View; m_View = 0; delete m_boxToolbar; delete m_homeButton; delete m_docButton; delete m_location; delete m_up; - delete m_pseudo; - if(m_pseudoLayout!=0 ) // why did you overload malloc - delete m_pseudoLayout; + //delete m_pseudo; + //if(m_pseudoLayout!=0 ) // why did you overload malloc + //delete m_pseudoLayout; m_boxToolbar = 0; m_homeButton = 0; m_docButton = 0; m_location = 0; m_up = 0; m_pseudo = 0; m_pseudoLayout = 0; // time for the toolbar m_pseudo = new QWidget(m_stack, "Pseudo Widget"); m_pseudoLayout = new QVBoxLayout(m_pseudo ); if(m_shTool ){ m_boxToolbar = new QHBoxLayout( ); m_boxToolbar->setAutoAdd( true ); m_location = new QComboBox(m_pseudo ); m_up = new QPushButton(Resource::loadIconSet("up"),"", m_pseudo,"cdUpButton"); m_up->setMinimumSize( QSize( 20, 20 ) ); m_up->setMaximumSize( QSize( 20, 20 ) ); connect(m_up ,SIGNAL(clicked()),this,SLOT(cdUP() ) ); m_up->setFlat(TRUE); m_homeButton = new QPushButton(Resource::loadIconSet("home") , "", m_pseudo); m_homeButton->setMinimumSize( QSize( 20, 20 ) ); m_homeButton->setMaximumSize( QSize( 20, 20 ) ); connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotHome() ) ); m_homeButton->setFlat(TRUE); m_docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"", m_pseudo,"docsButton"); m_docButton->setMinimumSize( QSize( 20, 20 ) ); m_docButton->setMaximumSize( QSize( 20, 20 ) ); connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotDoc() ) ); m_docButton->setFlat(TRUE); m_boxToolbar->addWidget(m_location ); m_boxToolbar->addWidget(m_up ); m_boxToolbar->addWidget(m_homeButton ); m_boxToolbar->addWidget(m_docButton ); m_pseudoLayout->addLayout(m_boxToolbar ); // lets fill the combobox StorageInfo storage; const QList<FileSystem> &fs = storage.fileSystems(); QListIterator<FileSystem> it ( fs ); for( ; it.current(); ++it ){ const QString disk = (*it)->name(); const QString path = (*it)->path(); m_location->insertItem(path+ "<-"+disk ); } int count = m_location->count(); m_location->insertItem(m_currentDir ); m_location->setCurrentItem( count ); }; m_View = new QListView(m_pseudo, "Extended view" ); m_stack->addWidget( m_pseudo, EXTENDED ); m_stack->raiseWidget( EXTENDED ); m_pseudoLayout->addWidget(m_View ); QPEApplication::setStylusOperation( m_View->viewport(),QPEApplication::RightOnHold); // set up the stuff // Pixmap Name Date Size mime //(m_View->header() )->hide(); //m_View->setRootIsDecorated(false); m_View->addColumn(" "); m_View->addColumn(tr("Name") ); m_View->addColumn(tr("Size") ); m_View->addColumn(tr("Date"), 60 ); m_View->addColumn(tr("Mime Type") ); QHeader *header = m_View->header(); header->hide(); m_View->setSorting(1 ); // connect now connect(m_View, SIGNAL(selectionChanged() ), this, SLOT(slotSelectionChanged() ) ); connect(m_View, SIGNAL(currentChanged(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(mouseButtonPressed(int, QListViewItem *, const QPoint &, int )), this, SLOT(slotRightButton(int, QListViewItem *, const QPoint &, int ) ) ); }; /* If a item is locked depends on the mode if we're in OPEN !isReadable is locked if we're in SAVE !isWriteable is locked */ void OFileSelector::addFile(const QString &mime, QFileInfo *info, bool symlink ){ qWarning("Add Files" ); if( !m_files ){ qWarning("not mfiles" ); return; } MimeType type( info->filePath() ); QString name; QString dir; bool locked= false; if(mime == "All" ){ ; }else if( type.id() != mime ) { return; } QPixmap pix = type.pixmap(); if(pix.isNull() ) pix = Resource::loadPixmap( "UnknownDocument-14" ); dir = info->dirPath( true ); if( symlink ) { // check if the readLink is readable // do it right later name = info->fileName() + " -> " + info->dirPath() + "/" + info->readLink(); }else{ // keep track of the icons name = info->fileName(); if( m_mode == OPEN ){ if( !info->isReadable() ){ locked = true; pix = Resource::loadPixmap("locked" ); } }else if( m_mode == SAVE ){ if( !info->isWritable() ){ locked = true; pix = Resource::loadPixmap("locked" ); } } } new OFileSelectorItem( m_View, pix, name, info->lastModified().toString(), QString::number( info->size() ), dir, locked ); } |