-rw-r--r-- | bin/kdepim/kmicromail/COPYRIGHTlibetpan | 28 | ||||
-rw-r--r-- | kmicromail/mainwindow.cpp | 27 | ||||
-rw-r--r-- | kmicromail/mainwindow.h | 3 | ||||
-rw-r--r-- | microkde/kapplication.cpp | 52 | ||||
-rw-r--r-- | microkde/kapplication.h | 1 |
5 files changed, 87 insertions, 24 deletions
diff --git a/bin/kdepim/kmicromail/COPYRIGHTlibetpan b/bin/kdepim/kmicromail/COPYRIGHTlibetpan new file mode 100644 index 0000000..a8b98f9 --- a/dev/null +++ b/bin/kdepim/kmicromail/COPYRIGHTlibetpan @@ -0,0 +1,28 @@ +libEtPan! -- a mail stuff library + +Copyright (C) 2001, 2002 - DINH Viet Hoa +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +3. Neither the name of the libEtPan! project nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. diff --git a/kmicromail/mainwindow.cpp b/kmicromail/mainwindow.cpp index aa51a37..24196b4 100644 --- a/kmicromail/mainwindow.cpp +++ b/kmicromail/mainwindow.cpp @@ -1,238 +1,265 @@ #include <qlabel.h> #include <qvbox.h> #include <qheader.h> #include <qtimer.h> #include <qlayout.h> #include <kdialog.h> #include <kiconloader.h> +#include <kapplication.h> #ifndef DESKTOP_VERSION #include <qpe/qpeapplication.h> #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( "OpieMail/Pi" ) ); 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 ); 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) ), SLOT( slotShowFolders(bool) ) ); /* searchMails = new QAction( tr( "Search mails" ), SmallIcon("find") ), 0, 0, this ); searchMails->addTo( toolBar ); searchMails->addTo( mailMenu ); */ deleteMails = new QAction(tr("Delete Mail"), SmallIcon("trash"), 0, 0, this); deleteMails->addTo( toolBar ); deleteMails->addTo( mailMenu ); connect( deleteMails, SIGNAL( activated() ), SLOT( slotDeleteMail() ) ); editSettings = new QAction( tr( "Edit settings" ), SmallIcon("SettingsIcon") , 0, 0, this ); editSettings->addTo( settingsMenu ); connect( editSettings, SIGNAL( activated() ), SLOT( slotEditSettings() ) ); editAccounts = new QAction( tr( "Configure accounts" ), SmallIcon("editaccounts") , 0, 0, this ); editAccounts->addTo( settingsMenu ); //setCentralWidget( view ); QVBox* wrapperBox = new QVBox( this ); setCentralWidget( wrapperBox ); // QWidget *view = new QWidget( wrapperBox ); KDGanttMinimizeSplitter* split = new KDGanttMinimizeSplitter( Qt::Horizontal, wrapperBox); split->setMinimizeDirection( KDGanttMinimizeSplitter::Left); //layout = new QBoxLayout ( split, QBoxLayout::LeftToRight ); folderView = new AccountView( split ); folderView->header()->hide(); folderView->setRootIsDecorated( false ); folderView->addColumn( tr( "Mailbox" ) ); //layout->addWidget( folderView ); mailView = new QListView( split ); mailView->addColumn( tr( " " ) ); mailView->addColumn( tr( "Subject" ),QListView::Manual ); mailView->addColumn( tr( "Sender" ),QListView::Manual ); mailView->addColumn( tr( "Size" ),QListView::Manual); mailView->addColumn( tr( "Date" ),QListView::Manual); mailView->setAllColumnsShowFocus(true); //mailView->setSorting(-1); mailView->setRootIsDecorated( false ); 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 ); 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 ); 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); + + + QPopupMenu* helpMenu = new QPopupMenu( menuBar ); + menuBar->insertItem( tr( "Help" ), helpMenu ); + QAction* li = new QAction(tr("About"), QPixmap(), 0, 0, this); + connect( li, SIGNAL( activated() ), SLOT( showAbout()) ); + li->addTo(helpMenu); + li = new QAction(tr("Licence"),QPixmap(), 0, 0, this); + connect( li, SIGNAL( activated() ), SLOT( showLicence()) ); + li->addTo(helpMenu); + li = new QAction(tr("LibEtPan Licence"), QPixmap(), 0, 0, this); + connect( li, SIGNAL( activated() ), SLOT( showEtpanLicence()) ); + li->addTo(helpMenu); } MainWindow::~MainWindow() { } +void MainWindow::showLicence() +{ + KApplication::showLicence(); +} +void MainWindow::showAbout() +{ + qDebug("MainWindow::showAbout() "); +} +void MainWindow::showEtpanLicence() +{ + KApplication::showFile( "LibEtPan licence", "kdepim/kmicromail/COPYRIGHTlibetpan" ); + +} 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, 100 ); mailView->setColumnWidth( 2, 100 ); mailView->setColumnWidth( 3, 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: "); } void MainWindow::slotDeleteMail() { qDebug("not implemented: "); } void MainWindow::mailHold(int, QListViewItem *,const QPoint&,int ) { qDebug("not implemented: "); } void MainWindow::slotSendQueued() { qDebug("not implemented: "); } void MainWindow::slotEditAccounts() { qDebug("not implemented: "); } void MainWindow::slotComposeMail() { qDebug("not implemented: "); } diff --git a/kmicromail/mainwindow.h b/kmicromail/mainwindow.h index 0cb252c..d6dc6cc 100644 --- a/kmicromail/mainwindow.h +++ b/kmicromail/mainwindow.h @@ -1,56 +1,59 @@ #ifndef MAINWINDOW_H #define MAINWINDOW_H #include <qmainwindow.h> #include <qlistview.h> #include <qaction.h> #include <qtoolbar.h> #include <qmenubar.h> #include "accountview.h" #include "statuswidget.h" #include <libmailwrapper/mailtypes.h> #include <opie2/osmartpointer.h> class RecMail; class MainWindow : public QMainWindow { Q_OBJECT public: MainWindow( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 ); virtual ~MainWindow(); public slots: virtual void slotAdjustColumns(); virtual void appMessage(const QCString &msg, const QByteArray &data); virtual void slotComposeMail(); protected slots: virtual void slotSendQueued(); virtual void slotEditAccounts(); virtual void slotShowFolders( bool show ); virtual void refreshMailView(const QValueList<RecMailP>&); virtual void displayMail(); virtual void slotDeleteMail(); virtual void mailHold(int, QListViewItem *,const QPoint&,int); virtual void slotAdjustLayout(); virtual void slotEditSettings(); virtual void mailLeftClicked( QListViewItem * ); + void showLicence(); + void showAbout(); + void showEtpanLicence(); protected: QToolBar *toolBar; StatusWidget *statusWidget; QMenuBar *menuBar; QPopupMenu *mailMenu, *settingsMenu; QAction *composeMail, *sendQueued, *showFolders, *searchMails, *deleteMails, *editSettings, *editAccounts, *syncFolders; AccountView *folderView; QListView *mailView; //QBoxLayout *layout; }; #endif diff --git a/microkde/kapplication.cpp b/microkde/kapplication.cpp index f0de71e..ad0b78e 100644 --- a/microkde/kapplication.cpp +++ b/microkde/kapplication.cpp @@ -1,75 +1,79 @@ #include <stdlib.h> #include <stdio.h> #include "kapplication.h" #include <qapplication.h> #include <qstring.h> #include <qfile.h> #include <qtextstream.h> #include <qdialog.h> #include <qlayout.h> #include <qtextbrowser.h> int KApplication::random() { return rand(); } //US QString KApplication::randomString(int length) { if (length <=0 ) return QString::null; QString str; while (length--) { int r=random() % 62; r+=48; if (r>57) r+=7; if (r>90) r+=6; str += char(r); // so what if I work backwards? } return str; } int KApplication::execDialog( QDialog* d ) { if (QApplication::desktop()->width() <= 640 ) d->showMaximized(); return d->exec(); } void KApplication::showLicence() { - QString fileName ; - QString text; + KApplication::showFile( "KDE-Pim/Pi licence", "kdepim/LICENCE.TXT" ); +} + +void KApplication::showFile(QString caption, QString fn) +{ + QString text; + QString fileName; #ifndef DESKTOP_VERSION fileName = getenv("QPEDIR"); - fileName += "/pics/kdepim/LICENCE.TXT" ; + fileName += "/pics/" + fn ; #else - fileName = qApp->applicationDirPath () + "/kdepim/LICENCE.TXT"; + fileName = qApp->applicationDirPath () + "/" + fn; #endif - QFile file( fileName ); - qDebug("Licence file name %s ",fileName.latin1() ); - if (!file.open( IO_ReadOnly ) ) { - return ; - } - QTextStream ts( &file ); - text = ts.read(); - file.close(); - - QDialog dia( 0, "name", true ); ; - dia.setCaption( "KDE-Pim/Pi licence" ); - QVBoxLayout* lay = new QVBoxLayout( &dia ); - lay->setSpacing( 3 ); - lay->setMargin( 3 ); - QTextBrowser tb ( &dia ); - lay->addWidget( &tb ); - tb.setText( text ); + QFile file( fileName ); + if (!file.open( IO_ReadOnly ) ) { + return ; + } + QTextStream ts( &file ); + text = ts.read(); + file.close(); + + QDialog dia( 0, "name", true ); ; + dia.setCaption( caption ); + QVBoxLayout* lay = new QVBoxLayout( &dia ); + lay->setSpacing( 3 ); + lay->setMargin( 3 ); + QTextBrowser tb ( &dia ); + lay->addWidget( &tb ); + tb.setText( text ); #ifdef DESKTOP_VERSION - dia.resize( 640, 480); + dia.resize( 640, 480); #else - dia.showMaximized(); + dia.showMaximized(); #endif - dia.exec(); + dia.exec(); } diff --git a/microkde/kapplication.h b/microkde/kapplication.h index 9515c60..5ae5c00 100644 --- a/microkde/kapplication.h +++ b/microkde/kapplication.h @@ -1,24 +1,25 @@ #ifndef MINIKDE_KAPPLICATION_H #define MINIKDE_KAPPLICATION_H #include "qstring.h" #include <qdialog.h> class KApplication { public: static int random(); //US /** * Generates a random string. It operates in the range [A-Za-z0-9] * @param length Generate a string of this length. * @return the random string */ static QString randomString(int length); static int execDialog( QDialog* ); static void showLicence(); + static void showFile(QString caption, QString file); }; #endif |