-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,31 +1,32 @@ #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 ); @@ -129,54 +130,80 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) 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(); diff --git a/kmicromail/mainwindow.h b/kmicromail/mainwindow.h index 0cb252c..d6dc6cc 100644 --- a/kmicromail/mainwindow.h +++ b/kmicromail/mainwindow.h @@ -19,38 +19,41 @@ 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 @@ -19,57 +19,61 @@ int KApplication::random() 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 |