-rw-r--r-- | kmicromail/mainwindow.cpp | 24 | ||||
-rw-r--r-- | kmicromail/viewmail.cpp | 3 | ||||
-rw-r--r-- | kmicromail/viewmailbase.cpp | 13 | ||||
-rw-r--r-- | kmicromail/viewmailbase.h | 2 |
4 files changed, 25 insertions, 17 deletions
diff --git a/kmicromail/mainwindow.cpp b/kmicromail/mainwindow.cpp index ddc7b3e..a500dec 100644 --- a/kmicromail/mainwindow.cpp +++ b/kmicromail/mainwindow.cpp @@ -11,51 +11,49 @@ #endif #include "defines.h" #include "mainwindow.h" #include <KDGanttMinimizeSplitter.h> #include <kabc/stdaddressbook.h> MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) : QMainWindow( parent, name, flags ) { setCaption( tr( "KMicroMail" ) ); setToolBarsMovable( false ); KABC::StdAddressBook::self(); toolBar = new QToolBar( this ); menuBar = new QMenuBar( toolBar ); mailMenu = new QPopupMenu( menuBar ); menuBar->insertItem( tr( "Mail" ), mailMenu ); settingsMenu = new QPopupMenu( menuBar ); menuBar->insertItem( tr( "Settings" ), settingsMenu ); addToolBar( toolBar ); toolBar->setHorizontalStretchable( true ); - QLabel *spacer = new QLabel( toolBar ); - spacer->setBackgroundMode( QWidget::PaletteButton ); - toolBar->setStretchableWidget( spacer ); + composeMail = new QAction( tr( "Compose new mail" ), SmallIcon("composemail"), 0, 0, this ); composeMail->addTo( toolBar ); composeMail->addTo( mailMenu ); sendQueued = new QAction( tr( "Send queued mails" ), SmallIcon("sendqueued") , 0, 0, this ); sendQueued->addTo( toolBar ); sendQueued->addTo( mailMenu ); /* syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC, 0, 0, this ); syncFolders->addTo( toolBar ); syncFolders->addTo( mailMenu ); */ showFolders = new QAction( tr( "Show/Hide folders" ), SmallIcon("showfolders") , 0, 0, this, 0, true ); showFolders->addTo( toolBar ); showFolders->addTo( mailMenu ); showFolders->setOn( true ); connect(showFolders, SIGNAL( toggled(bool) ), @@ -112,95 +110,103 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) statusWidget = new StatusWidget( wrapperBox ); statusWidget->hide(); //layout->addWidget( mailView ); //layout->setStretchFactor( folderView, 1 ); //layout->setStretchFactor( mailView, 2 ); slotAdjustLayout(); #ifndef DESKTOP_VERSION QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold); QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold); #endif connect( mailView, SIGNAL( doubleClicked (QListViewItem* )),this, SLOT( mailLeftClicked(QListViewItem*) ) ); connect( mailView, SIGNAL( returnPressed (QListViewItem* )),this, SLOT( mailLeftClicked(QListViewItem*) ) ); connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) ); connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)), this,SLOT(refreshMailView(const QValueList<RecMailP>&))); connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) ); connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) ); // connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) ); connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) ); - mailView->setMultiSelection ( true ); - //mailView->setSelectionMode( QListView::Extended ); + //mailView->setMultiSelection ( true ); + mailView->setSelectionMode( QListView::Extended ); QValueList<int> list; int fw = 100; if ( QApplication::desktop()->width() > 320 ) fw = 50; list.append( fw ); list.append( 100 ); split->setSizes( list ); QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); - mailView->setShowSortIndicator ( true ); + mailView->setShowSortIndicator ( true ); + QLabel *spacer = new QLabel( toolBar ); + spacer->setBackgroundMode( QWidget::PaletteButton ); + toolBar->setStretchableWidget( spacer ); + + QAction* closeMail = new QAction(tr("Close"),SmallIcon("exit"), 0, 0, this); + connect( closeMail, SIGNAL( activated() ), SLOT( close() ) ); + closeMail->addTo(toolBar); + closeMail->addTo(mailMenu); } MainWindow::~MainWindow() { } void MainWindow::appMessage(const QCString &, const QByteArray &) { qDebug("appMessage implemented by subclass"); } void MainWindow::slotAdjustLayout() { /* QWidget *d = QApplication::desktop(); if ( d->width() < d->height() ) { layout->setDirection( QBoxLayout::TopToBottom ); } else { layout->setDirection( QBoxLayout::LeftToRight ); } */ } void MainWindow::slotAdjustColumns() { bool hidden = folderView->isHidden(); if ( hidden ) folderView->show(); folderView->setColumnWidth( 0, folderView->visibleWidth() ); if ( hidden ) folderView->hide(); mailView->setColumnWidth( 0, 10 ); - mailView->setColumnWidth( 1, 80 ); - mailView->setColumnWidth( 2, 80 ); + mailView->setColumnWidth( 1, 100 ); + mailView->setColumnWidth( 2, 100 ); mailView->setColumnWidth( 3, 50 ); - mailView->setColumnWidth( 4, 50 ); + mailView->setColumnWidth( 4, 120 ); } void MainWindow::slotEditSettings() { } void MainWindow::slotShowFolders( bool ) { qDebug("not implemented: "); } void MainWindow::refreshMailView(const QValueList<RecMailP>&) { qDebug("not implemented: "); } void MainWindow::mailLeftClicked(QListViewItem * ) { qDebug("not implemented: "); } void MainWindow::displayMail() { qDebug("not implemented: "); diff --git a/kmicromail/viewmail.cpp b/kmicromail/viewmail.cpp index b434318..703711d 100644 --- a/kmicromail/viewmail.cpp +++ b/kmicromail/viewmail.cpp @@ -292,49 +292,50 @@ void ViewMail::setMail(const RecMailP&mail ) m_mail[0] = mail->getFrom(); m_mail[1] = mail->getSubject(); m_mail[3] = mail->getDate(); m_mail[4] = mail->Msgid(); m_mail2[0] = mail->To(); m_mail2[1] = mail->CC(); m_mail2[2] = mail->Bcc(); setText(); } ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl) : ViewMailBase(parent, name, fl), _inLoop(false) { m_gotBody = false; deleted = false; connect( reply, SIGNAL(activated()), SLOT(slotReply())); connect( forward, SIGNAL(activated()), SLOT(slotForward())); connect( deleteMail, SIGNAL( activated() ), SLOT( slotDeleteMail() ) ); - connect( showHtml, SIGNAL( toggled(bool) ), SLOT( slotShowHtml(bool) ) ); + connect( showHtml, SIGNAL( toggled(bool) ), SLOT( slotShowHtml(bool) ) ); + connect( closeMail, SIGNAL( activated() ), SLOT( close() ) ); attachments->setEnabled(m_gotBody); connect( attachments, SIGNAL( clicked(QListViewItem*,const QPoint&, int) ), SLOT( slotItemClicked(QListViewItem*,const QPoint&, int) ) ); readConfig(); attachments->setSorting(-1); } void ViewMail::readConfig() { Config cfg( "mail" ); cfg.setGroup( "Settings" ); m_showHtml = cfg.readBoolEntry( "showHtml", false ); showHtml->setOn( m_showHtml ); } void ViewMail::setText() { QString toString; QString ccString; QString bccString; for ( QStringList::Iterator it = ( m_mail2[0] ).begin(); it != ( m_mail2[0] ).end(); ++it ) diff --git a/kmicromail/viewmailbase.cpp b/kmicromail/viewmailbase.cpp index 2590481..584a0ac 100644 --- a/kmicromail/viewmailbase.cpp +++ b/kmicromail/viewmailbase.cpp @@ -5,74 +5,75 @@ #include <qvbox.h> #include <qtoolbar.h> #include <qmenubar.h> #include <kiconloader.h> //#include <qpe/resource.h> #include "viewmailbase.h" //#include "opendiag.h" ViewMailBase::ViewMailBase(QWidget *parent, const char *name, WFlags fl) : QMainWindow(parent, name, fl) { setToolBarsMovable(false); toolbar = new QToolBar(this); menubar = new QMenuBar( toolbar ); mailmenu = new QPopupMenu( menubar ); menubar->insertItem( tr( "Mail" ), mailmenu ); toolbar->setHorizontalStretchable(true); addToolBar(toolbar); - QLabel *spacer = new QLabel(toolbar); - spacer->setBackgroundMode(QWidget::PaletteButton); - toolbar->setStretchableWidget(spacer); - reply = new QAction(tr("Reply"),SmallIcon("reply"), 0, 0, this); reply->addTo(toolbar); reply->addTo(mailmenu); forward = new QAction(tr("Forward"),SmallIcon("forward"), 0, 0, this); forward->addTo(toolbar); forward->addTo(mailmenu); attachbutton = new QAction(tr("Attachments"),SmallIcon("attach"), 0, 0, this, 0, true); attachbutton->addTo(toolbar); attachbutton->addTo(mailmenu); connect(attachbutton, SIGNAL(toggled(bool)), SLOT(slotChangeAttachview(bool))); showHtml = new QAction( tr( "Show Html" ), SmallIcon( "html" ), 0, 0, this, 0, true ); showHtml->addTo( toolbar ); showHtml->addTo( mailmenu ); - deleteMail = new QAction(tr("Delete Mail"),SmallIcon("trash"), 0, 0, this); + deleteMail = new QAction(tr("Delete Mail"),SmallIcon("trash"), 0, 0, this); deleteMail->addTo(toolbar); deleteMail->addTo(mailmenu); - + closeMail = new QAction(tr("Close"),SmallIcon("exit"), 0, 0, this); + QLabel *spacer = new QLabel(toolbar); + spacer->setBackgroundMode(QWidget::PaletteButton); + toolbar->setStretchableWidget(spacer); + closeMail->addTo(toolbar); + closeMail->addTo(mailmenu); QVBox *view = new QVBox(this); setCentralWidget(view); attachments = new QListView(view); attachments->setMinimumHeight(90); attachments->setMaximumHeight(90); attachments->setAllColumnsShowFocus(true); attachments->addColumn("Mime Type", 60); attachments->addColumn(tr("Description"), 100); attachments->addColumn(tr("Filename"), 80); attachments->addColumn(tr("Size"), 80); attachments->setSorting(-1); attachments->hide(); browser = new QTextBrowser(view); // openDiag = new OpenDiag(view); // openDiag->hide(); } void ViewMailBase::slotChangeAttachview(bool state) { if (state) attachments->show(); diff --git a/kmicromail/viewmailbase.h b/kmicromail/viewmailbase.h index fdaad2a..c29d143 100644 --- a/kmicromail/viewmailbase.h +++ b/kmicromail/viewmailbase.h @@ -1,38 +1,38 @@ #ifndef VIEWMAILBASE_H #define VIEWMAILBASE_H #include <qmainwindow.h> class QAction; class OpenDiag; class QListView; class QToolBar; class QTextBrowser; class QMenuBar; class QPopupMenu; class ViewMailBase : public QMainWindow { Q_OBJECT public: ViewMailBase(QWidget *parent = 0, const char *name = 0, WFlags fl = 0); protected: - QAction *reply, *forward, *attachbutton, *deleteMail, *showHtml; + QAction *reply, *forward, *attachbutton, *deleteMail, *showHtml, *closeMail; QListView *attachments; QToolBar *toolbar; QTextBrowser *browser; OpenDiag *openDiag; QMenuBar *menubar; QPopupMenu *mailmenu; protected slots: void slotChangeAttachview(bool state); virtual void keyPressEvent ( QKeyEvent * e ); }; #endif |