summaryrefslogtreecommitdiff
authorzecke <zecke>2002-04-12 13:07:35 (UTC)
committer zecke <zecke>2002-04-12 13:07:35 (UTC)
commit3973cf42c778055ab81a9ee254eaf8829464f936 (patch) (side-by-side diff)
tree4ae4fc512c9e37657ea9f4e05f28d1ea57a855d3
parentc1c9ac64f7f4871642d645ac1da1a2f36853ccb2 (diff)
downloadopie-3973cf42c778055ab81a9ee254eaf8829464f936.zip
opie-3973cf42c778055ab81a9ee254eaf8829464f936.tar.gz
opie-3973cf42c778055ab81a9ee254eaf8829464f936.tar.bz2
Add OFileDialog to the .pro
OFileDialog is now working resize it when not used by the static methods OFileSelector some bugfixes. Some bugs are not yet fixed (the switching from views can segfault )
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/libopie.pro4
-rw-r--r--libopie/ofiledialog.cc14
-rw-r--r--libopie/ofileselector.cc40
3 files changed, 20 insertions, 38 deletions
diff --git a/libopie/libopie.pro b/libopie/libopie.pro
index 4ba2836..3c8da78 100644
--- a/libopie/libopie.pro
+++ b/libopie/libopie.pro
@@ -1,8 +1,8 @@
TEMPLATE = lib
CONFIG += qte warn_on release
-HEADERS = ofileselector.h tododb.h todoevent.h todoresource.h todovcalresource.h xmltree.h oconfig.h
-SOURCES = ofileselector.cc xmltree.cc tododb.cpp todoevent.cpp todovcalresource.cpp oconfig.cpp
+HEADERS = ofileselector.h ofiledialog.h tododb.h todoevent.h todoresource.h todovcalresource.h xmltree.h oconfig.h
+SOURCES = ofileselector.cc ofiledialog.cc xmltree.cc tododb.cpp todoevent.cpp todovcalresource.cpp oconfig.cpp
TARGET = opie
INCLUDEPATH += $(OPIEDIR)/include
DESTDIR = $(QTDIR)/lib$(PROJMAK)
#VERSION = 1.0.0 \ No newline at end of file
diff --git a/libopie/ofiledialog.cc b/libopie/ofiledialog.cc
index 92b0d0a..164fadd 100644
--- a/libopie/ofiledialog.cc
+++ b/libopie/ofiledialog.cc
@@ -31,77 +31,83 @@
#include <qapplication.h>
#include <qlayout.h>
#include "ofiledialog.h"
OFileDialog::OFileDialog(const QString &caption,
QWidget *wid, int mode, int selector,
const QString &dirName,
const QString &fileName,
const QStringList &mimetypes )
: QDialog( wid, "OFileDialog", true )
{
- QVBoxLayout *lay = new QVBoxLayout(this);
-
- file = new OFileSelector(0 , mode, selector,
+ // 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(dirSelected(const QString &) ),
this, SLOT(slotDirSelected(const QString &) ) );
- showMaximized();
+
+
file->setYesCancelVisible( false ); // relayout
}
QString OFileDialog::mimetype()const
{
return QString::null;
}
QString OFileDialog::fileName()const
{
return file->selectedName();
}
DocLnk OFileDialog::selectedDocument()const
{
return file->selectedDocument();
}
QString OFileDialog::getOpenFileName(int selector,
const QString &startDir,
const QString &file,
const QStringList &mimes,
QWidget *wid,
const QString &caption )
{
QString ret;
OFileDialog dlg( caption.isEmpty() ? tr("Open") : caption,
wid, OFileSelector::OPEN, selector, startDir, file, mimes);
+ dlg.showMaximized();
if( dlg.exec() )
ret = dlg.fileName();
return ret;
}
QString OFileDialog::getSaveFileName(int selector,
const QString &startDir,
const QString &file,
const QStringList &mimes,
QWidget *wid,
const QString &caption )
{
QString ret;
OFileDialog dlg( caption.isEmpty() ? tr("Save") : caption,
wid, OFileSelector::SAVE, selector, startDir, file, mimes);
+ dlg.showMaximized();
if( dlg.exec() )
ret = dlg.fileName();
return ret;
}
void OFileDialog::slotFileSelected(const QString & )
{
accept();
}
void OFileDialog::slotDirSelected(const QString & )
{
diff --git a/libopie/ofileselector.cc b/libopie/ofileselector.cc
index c3a3514..7451c1b 100644
--- a/libopie/ofileselector.cc
+++ b/libopie/ofileselector.cc
@@ -70,26 +70,26 @@ namespace {
break;
}
}
return index;
}
};
OFileSelector::OFileSelector(QWidget *wid, int mode, int selector, const QString &dirName,
const QString &fileName, const QStringList &mimetypes ) : QWidget( wid )
{
-
- resize(wid->width(),wid->height());
+ if(wid!=0)
+ resize(wid->width(),wid->height());
m_selector = selector;
m_currentDir = dirName;
m_name = fileName;
m_mimetypes = mimetypes;
if( mimetypes.isEmpty() )
m_autoMime = true;
m_mode = mode;
m_shTool = true;
m_shPerm = true;
m_shLne = true;
m_shChooser = true;
@@ -185,24 +185,25 @@ void OFileSelector::init()
m_stack = new QWidgetStack(this, "wstack" );
if( m_selector == NORMAL ){
QString currMime;
if( m_mimeCheck != 0 )
currMime = m_mimeCheck->currentText();
updateMimes();
m_select = new FileSelector( currMime == "All" ? QString::null : currMime , m_stack, "fileselector", FALSE, FALSE );
m_stack->addWidget(m_select, NORMAL );
m_lay->addWidget(m_stack );
m_stack->raiseWidget(NORMAL );
connect(m_select, SIGNAL(fileSelected( const DocLnk &) ), this, SLOT(slotFileBridgeSelected(const DocLnk &) ) );
+ m_pseudoLayout = 0l;
}else {
initializeListView();
}
if(m_shLne ){
initializeName();
}
if(m_shPerm ){
m_checkPerm = new QCheckBox(tr("Set Permission"), this, "Permission" );
m_checkPerm->setChecked( false );
m_lay->addWidget(m_checkPerm );
@@ -586,25 +587,26 @@ void OFileSelector::slotViewCheck(const QString &view ){
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;
- 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,
@@ -615,64 +617,37 @@ void OFileSelector::slotViewCheck(const QString &view ){
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;
- delete m_boxToolbar;
- delete m_homeButton;
- delete m_docButton;
- delete m_location;
- delete m_up;
- delete m_pseudo;
- delete m_pseudoLayout;
- m_boxToolbar = 0;
- m_homeButton = 0;
- m_docButton = 0;
- m_location = 0;
- m_up = 0;
- m_pseudo = 0;
- m_pseudoLayout = 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;
- delete m_boxToolbar;
- delete m_homeButton;
- delete m_docButton;
- delete m_location;
- delete m_up;
- delete m_pseudo;
- delete m_pseudoLayout;
- m_boxToolbar = 0;
- m_homeButton = 0;
- m_docButton = 0;
- m_location = 0;
- m_up = 0;
- m_pseudo = 0;
- m_pseudoLayout = 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();
@@ -692,25 +667,26 @@ void OFileSelector::updateMimes() // lets check which mode is active
};
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;
- delete m_pseudoLayout;
+ 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( );