// Markus: d&d works now. Attach-filedlg works now.

svn path=/trunk/kdenetwork/kmail/; revision=944
wilder-work
cvs 29 years ago
parent 5dbaf93db7
commit 31a52acb00
  1. 107
      kmcomposewin.cpp
  2. 3
      kmcomposewin.h
  3. 12
      kmreaderwin.cpp

@ -16,7 +16,7 @@
KMComposeView::KMComposeView(QWidget *parent, const char *name, QString emailAddress, KMMessage *message, int action) : QWidget(parent, name)
{
printf("Entering composeView\n");
grid = new QGridLayout(this,10,2,4,4);
grid = new QGridLayout(this,10,2,2,4);
attWidget = NULL;
if (message) currentMessage = message;
@ -58,8 +58,8 @@ KMComposeView::KMComposeView(QWidget *parent, const char *name, QString emailAdd
zone = new KDNDDropZone(editor,DndURL);
connect(zone,SIGNAL(dropAction(KDNDDropZone *)),SLOT(getDNDAttachment()));
urlList = new QStrList;
grid->setColStretch(1,100);
@ -88,14 +88,16 @@ KMComposeView::KMComposeView(QWidget *parent, const char *name, QString emailAdd
void KMComposeView::getDNDAttachment()
{
const char *element;
printf("Attachment droped\n");
*urlList = zone->getURLList();
QString element;
printf("File droped\n");
QStrList *tempList = new QStrList();
*tempList= zone->getURLList();
urlList->append(tempList->first());
element = urlList->first();
cout << element << "\n";
cout << "Elements in the list: " << urlList->count() << "\n";
while(urlList->next() != 0)
cout << element << "\n";
while(element.isEmpty() == FALSE)
{cout << element << "\n";
element = urlList->next();}
}
KMComposeView::~KMComposeView()
@ -130,89 +132,16 @@ void KMComposeView::printIt()
void KMComposeView::attachFile()
{
#ifdef BROKEN
QString atmntFile;
const char *B[] = BODYTYPE;
struct stat atmntStat;
QString fileName;
QFileDialog *d=new QFileDialog(".","*",this,NULL,TRUE);
d->setCaption("Attach File");
if (d->exec())
{atmntFile = d->selectedFile();
Attachment *a = new Attachment();
if(!a->guess(atmntFile))
KMsgBox::message(0,"Ouch","Trouble guessing attachment!\n");
else
{printf("Guessing successfull...\n");
if(!attWidget)
{printf("Creating Attachment Widget\n");
attWidget = new KTabListBox(this);
attWidget->setNumCols(3);
attWidget->setColumn(0,"Filename",width()/2-20);
attWidget->setColumn(1,"File Type",width()/4);
attWidget->setColumn(2,"File Size",width()/4);
cout << "Attachment File: " << atmntFile << "\n";
fileName =atmntFile.copy();
attachmentList.append( new KMAttachmentItem(fileName,indexAttachment));
KMAttachmentItem *itm;
printf("About to display list:\n\n");
for ( itm=attachmentList.first(); itm != 0; itm = attachmentList.next() )
cout << "FileName: " << itm->fileName << "\tIndex: " << itm->index << "\n";
printf("\nDone displaying list\n");
::stat(atmntFile,&atmntStat);
QString temp;
temp.sprintf("%s",B[a->getType()]);
atmntFile += "\t";
atmntFile += temp;
atmntFile += "\t";
temp.sprintf("%ld bytes",atmntStat.st_size);
atmntFile +=temp;
attWidget->insertItem(atmntFile);
indexAttachment++;
attWidget->setAutoUpdate(TRUE);
attWidget->show();
connect(attWidget,SIGNAL(highlighted(int,int)),SLOT(detachFile(int,int)));
resizeEvent(NULL);
delete itm;
atmntFile="";
}
else
{printf("We already have a widget\n");
cout << "Attachment File: " << atmntFile << "\n";
fileName = atmntFile.copy();
attachmentList.append( new KMAttachmentItem(fileName,indexAttachment));
KMAttachmentItem *itm;
printf("About to display list:\n\n");
for ( itm=attachmentList.first(); itm != 0; itm = attachmentList.next())
cout << "FileName: " << itm->fileName << "\tIndex: " << itm->index << "\n";
printf("\nDone displaying list\n");
::stat(atmntFile,&atmntStat);
QString temp;
temp.sprintf("%s",B[a->getType()]);
atmntFile += "\t";
atmntFile += temp;
atmntFile += "\t";
temp.sprintf("%ld bytes",atmntStat.st_size);
atmntFile +=temp;
attWidget->insertItem(atmntFile);
indexAttachment++;
attWidget->setAutoUpdate(TRUE);
attWidget->show();
connect(attWidget,SIGNAL(selected(int,int)),SLOT(detachFile(int,int)));
attWidget->repaint();
delete itm;
atmntFile="";
}
fileName ="";
delete a;
}
}
atmntFile = d->selectedFile();
delete d;
#endif
urlList->append(atmntFile);
}
void KMComposeView::sendIt()
@ -492,11 +421,11 @@ KMComposeWin::KMComposeWin(QWidget *, const char *name, QString emailAddress, KM
parseConfiguration();
composeView = new KMComposeView(this,NULL,emailAddress,message,action);
setView(composeView);
setView(composeView,FALSE);
setupMenuBar();
setupToolBar();
setupStatusBar();
printf("toolBarStatus in Constr. = %i\n",toolBarStatus);
if(toolBarStatus==false)
@ -656,6 +585,14 @@ void KMComposeWin::setupToolBar()
addToolBar(toolBar);
}
void KMComposeWin::setupStatusBar()
{
statusBar = new KStatusBar(this);
statusBar->insertItem("Status:",0);
setStatusBar(statusBar);
}
void KMComposeWin::doNewMailReader()
{
KMMainWin *newReader = new KMMainWin(NULL);

@ -23,6 +23,7 @@
#include <kapp.h>
#include <kmsgbox.h>
#include "ktablistbox.h"
#include <kstatusbar.h>
#include <qpainter.h>
#include <drag.h>
#define FORWARD 0
@ -99,9 +100,11 @@ public:
private:
KToolBar *toolBar;
KMenuBar *menuBar;
KStatusBar *statusBar;
KMComposeView *composeView;
void setupMenuBar();
void setupToolBar();
void setupStatusBar();
bool toolBarStatus, sigStatus, sendButton;
QWidget *setWidget;
QRadioButton *isLater;

@ -103,13 +103,13 @@ void KMReaderView::resizeEvent(QResizeEvent *)
void KMReaderView::parseMessage(KMMessage *message)
{
QString fromStr;
QString strTemp;
QString str1Temp;
QString subjStr;
QString text;
QString header;
QString dateStr;
QString fromStr;
QString toStr;
QString ccStr;
long length;
@ -137,12 +137,12 @@ void KMReaderView::parseMessage(KMMessage *message)
strTemp = strTemp.stripWhiteSpace();
fromStr.append(strTemp + "</A>"+"<br>");
strTemp.sprintf("%s",message->cc());
strTemp = strTemp.stripWhiteSpace();
if(strTemp.isEmpty())
ccStr = message->cc();
if(ccStr.isEmpty())
ccStr = "";
else
ccStr.sprintf("Cc: %s<br>",message->cc());
{ccStr="";
ccStr.sprintf("Cc: %s<br>",message->cc());}
subjStr.sprintf("Subject: %s<br><P>",message->subject());
@ -154,6 +154,7 @@ void KMReaderView::parseMessage(KMMessage *message)
// header
messageCanvas->write("<TABLE><TR><TD><IMG SRC=\"" + picsDir +"/kdelogo.xpm\"></TD><TD HSPACE=50><B>");
messageCanvas->write(subjStr);
messageCanvas->write(fromStr);
messageCanvas->write(toStr);
messageCanvas->write(ccStr);
messageCanvas->write(dateStr);
@ -467,7 +468,6 @@ KMReaderWin::KMReaderWin(QWidget *, const char *, int msgno = 0,KMFolder *f =0)
if(!showToolBar)
enableToolBar(KToolBar::Hide);
resize(480, 510);
}

Loading…
Cancel
Save