summaryrefslogtreecommitdiff
authorzecke <zecke>2004-03-25 20:13:01 (UTC)
committer zecke <zecke>2004-03-25 20:13:01 (UTC)
commit1db459f8a2e3846397bef77bd0f47b70a0e01612 (patch) (side-by-side diff)
tree4fc77e5b0f6f9cb77adee3e816e9c057c1c6264c
parent875064bec847768670d33cddf8553ce89ef4a5d5 (diff)
downloadopie-1db459f8a2e3846397bef77bd0f47b70a0e01612.zip
opie-1db459f8a2e3846397bef77bd0f47b70a0e01612.tar.gz
opie-1db459f8a2e3846397bef77bd0f47b70a0e01612.tar.bz2
Do not rely on Qt magic.
Get the item, take it from the list, delete it
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfmMenu.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp
index 2461e26..81a4318 100644
--- a/noncore/apps/advancedfm/advancedfmMenu.cpp
+++ b/noncore/apps/advancedfm/advancedfmMenu.cpp
@@ -783,56 +783,57 @@ void AdvancedFm::doRename(QListView * view) {
QRect r = view->itemRect( view->currentItem( ));
r = QRect( view->viewportToContents( r.topLeft() ), r.size() );
r.setX( view->contentsX() );
if ( r.width() > view->visibleWidth() )
r.setWidth( view->visibleWidth() );
renameBox = new QLineEdit( view->viewport(), "qt_renamebox" );
renameBox->setFrame(true);
renameBox->setText( view->currentItem()->text(0) );
renameBox->selectAll();
renameBox->installEventFilter( this );
view->addChild( renameBox, r.x(), r.y() );
renameBox->resize( r.size() );
view->viewport()->setFocusProxy( renameBox );
renameBox->setFocus();
renameBox->show();
}
void AdvancedFm::renameIt() {
if( !CurrentView()->currentItem()) return;
QListView *thisView = CurrentView();
oldName = thisView->currentItem()->text(0);
doRename( thisView );
}
void AdvancedFm::okRename() {
if( !renameBox) return;
QString newName = renameBox->text();
cancelRename();
QListView * view = CurrentView();
QString path = CurrentDir()->canonicalPath() + "/";
oldName = path + oldName;
newName = path + newName;
if( rename( oldName.latin1(), newName.latin1())== -1)
QMessageBox::message(tr("Note"),tr("Could not rename"));
else
oldName = "";
- view->takeItem( view->currentItem() );
- delete view->currentItem();
+ QListViewItem *item = view->currentItem();
+ view->takeItem( item );
+ delete item;
rePopulate();
}
void AdvancedFm::openSearch() {
QMessageBox::message(tr("Note"),tr("Not Yet Implemented"));
}