summaryrefslogtreecommitdiff
path: root/noncore/net/mailit/addatt.cpp
Side-by-side diff
Diffstat (limited to 'noncore/net/mailit/addatt.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mailit/addatt.cpp34
1 files changed, 14 insertions, 20 deletions
diff --git a/noncore/net/mailit/addatt.cpp b/noncore/net/mailit/addatt.cpp
index f279f52..c8be865 100644
--- a/noncore/net/mailit/addatt.cpp
+++ b/noncore/net/mailit/addatt.cpp
@@ -1,160 +1,154 @@
/**********************************************************************
** Copyright (C) 2001 Trolltech AS. All rights reserved.
**
** This file is part of Qt Palmtop Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include <qlayout.h>
+#include <qhbox.h>
#include <qdir.h>
#include <qstringlist.h>
#include "resource.h"
#include "addatt.h"
FileItem::FileItem(QListView *parent, DocLnk* dl)
: QListViewItem(parent)
{
/*file = fileInfo;
type = fileType;*/
doclnk=dl;
setText(0, doclnk->name());
/* if (fileType == "Picture") {
setPixmap(0, Resource::loadPixmap("pixmap"));
} else if (fileType == "Document") {
setPixmap(0, Resource::loadPixmap("txt"));
} else if (fileType == "Sound") {
setPixmap(0, Resource::loadPixmap("play"));
} else if (fileType == "Movie") {
setPixmap(0, Resource::loadPixmap("MPEGPlayer"));
} else if (fileType == "File") {
setPixmap(0, Resource::loadPixmap("exec"));
}*/
}
FileItem::~FileItem()
{
if (doclnk!=NULL) delete doclnk;
doclnk=NULL;
}
AddAtt::AddAtt(QWidget *parent, const char *name, WFlags f)
: QDialog(parent, name, f)
{
setCaption("Adding attatchments");
- QGridLayout *top = new QGridLayout(this, 3,1 );
+ QGridLayout *top = new QGridLayout(this, 1,1 );
-
+ QHBox *buttons=new QHBox(this);
/*fileCategoryButton = new QPushButton(this);*/
- attatchButton = new QPushButton("Attatch ->", this);
- removeButton = new QPushButton("Remove", this);
+ attatchButton = new QPushButton("Attatch ->", buttons);
+ removeButton = new QPushButton("Remove", buttons);
/*fileCategories = new QPopupMenu(fileCategoryButton);
fileCategoryButton->setPopup(fileCategories);
fileCategories->insertItem("Document");
fileCategories->insertItem("Picture");
fileCategories->insertItem("Sound");
fileCategories->insertItem("Movie");
fileCategories->insertItem("File");
fileCategoryButton->setText("Document");
top->addWidget(fileCategoryButton, 0, 0);*/
- //ofs=new OFileSelector(this,2,0,"/root/Documents");
-
-
- top->addWidget(attatchButton,1,0);
- top->addWidget(removeButton,2,0);
- /*connect(fileCategories, SIGNAL(activated(int)), this,
- SLOT(fileCategorySelected(int)) );*/
+ top->addWidget(buttons,1,0);
+ //buttons->addWidget(attatchButton,0,0);
+ //buttons->addWidget(removeButton,0,1);
+
+ //connect(fileCategories, SIGNAL(activated(int)), this,
+ // SLOT(fileCategorySelected(int)) );*/
connect(attatchButton, SIGNAL(clicked()), this,
SLOT(addAttatchment()) );
connect(removeButton, SIGNAL(clicked()), this,
SLOT(removeAttatchment()) );
/*listView = new QListView(this, "AttView");
listView->addColumn("Documents");*
connect(listView, SIGNAL(doubleClicked(QListViewItem *)), this,
SLOT(addAttatchment()) );*/
attView = new QListView(this, "Selected");
attView->addColumn(tr("Attached"));
attView->addColumn(tr("File type"));
connect(attView, SIGNAL(doubleClicked(QListViewItem *)), this,
SLOT(removeAttatchment()) );
//top->addWidget(ofs, 0,0);
top->addWidget(attView, 0,0);
clear();
}
void AddAtt::clear()
{
attView->clear();
//getFiles();
modified = FALSE;
}
/*void AddAtt::fileCategorySelected(int id)
{
fileCategoryButton->setText(fileCategories->text(id));
getFiles();
}*/
void AddAtt::addAttatchment()
{
- QDialog qd(this,tr("Select attachment"),true);
-
- QGridLayout top(&qd,1,1);
-
- OFileSelector ofs(&qd,1,0,"/root/Documents");
-
- top.addWidget(&ofs,0,0);
+ OFileDialog ofs("Attachments",this,0,0,"/root/Documents");
- qd.showMaximized();
+ ofs.showMaximized();
- if (qd.exec()==QDialog::Accepted)
+ if (ofs.exec()==QDialog::Accepted)
{
DocLnk* dl=new DocLnk(ofs.selectedDocument());
FileItem* fi=new FileItem(attView,dl);
fi->setPixmap(0,dl->pixmap());
fi->setText(1,dl->type());
attView->insertItem(fi);
modified = TRUE;
}
}
void AddAtt::removeAttatchment()
{
if (attView->selectedItem() != NULL)
{
attView->takeItem(attView->selectedItem());
}
modified = TRUE;
}
void AddAtt::reject()
{
if (modified) {
attView->clear();
modified = FALSE;