summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/WhatsNew.txt10
-rw-r--r--kaddressbook/kabcore.cpp11
-rw-r--r--kaddressbook/viewmanager.cpp11
-rw-r--r--kmicromail/libmailwrapper/settings.cpp2
-rw-r--r--kmicromail/opiemail.cpp27
-rw-r--r--kmicromail/opiemail.h2
-rw-r--r--kmicromail/viewmail.cpp5
-rw-r--r--kmicromail/viewmail.h1
-rw-r--r--korganizer/calendarview.cpp24
-rw-r--r--qtcompat/qinputdialog.cpp7
10 files changed, 80 insertions, 20 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt
index 46d59a3..ec75fad 100644
--- a/bin/kdepim/WhatsNew.txt
+++ b/bin/kdepim/WhatsNew.txt
@@ -1,205 +1,215 @@
Info about the changes in new versions of KDE-Pim/Pi
********** VERSION 1.9.15 ************
Usebilty enhancements in KO/Pi:
When clicking on the date in a month view cell, the day view is shown.
Old behaviour was, that the "new event" dialog popped up.
Added a one step "undo delete" in KO/Pi (Accessable in the "Action" menu).
That means, you can restore the latest
event/todo/journal you have deleted.
A journal is deleted, if you clear all the text of the journal.
+Fixed the bug of the editor dialogs in KO/Pi of version 1.9.14.
+
+KA/Pi starting in 480x640 resolution:
+Hide the filter action in toolbar
+and added icons for undo/delete/redo in toolbar.
+
+Change in OM/Pi ViewMail dialog:
+When clicking on the "delete" icon the mail is deleted after confirmation as usual. But the edit dialog is not closed as before, now the next mail in the folder is shown automatically (if there is any).
+
+Fixed a crash when deleting mail-accounts in OM/Pi.
********** VERSION 1.9.14 ************
Fixed some problems with the dialog sizes when switching
portrait/landscape mode on 640x480 PDA display.
Fixed some other small bugs in KA/Pi KO/Pi and OM/Pi and PwM/Pi.
Fixed an ugly bug in KOpieMail:
KOpieMail was not able to write files (mails) to MSDOS file system,
like on an usual preformatted SD card. That should work now.
To save your mail data on the Sd card do the following:
Create a dir on the SD card:
mkdir /mnt/card/localmail
Go to your home dir:
cd
Go to kopiemail data storage dir:
cd kdepim/apps/kopiemail
Create a symlink to the SD card:
ls -s /mnt/card/localmail
Now KOpieMail will store all mails on the SD card.
KO/Pi Monthview:
Now "Go to Today" selects the current month from day 1-end,
not the current date + some days.
I.e. "Go to Today" shows now always
the current month with first day of month in the first row.
Added missing German translation.
Fixed icons of executeable on Wintendo.
Added a "Show next Mail" button to the OM/Pi
mail viewer such that the mail below the current mail
in the mail list view of the current folder
can be read with a single click.
********** VERSION 1.9.13 ************
Fixed nasty PwM/Pi file reading bug, when
the used hash algo of file is different then the global
hash algo.
Added KA/Pi support for opie mailit mailapplication.
Fixed some bugs in OM/Pi.
Now character conversion tables are available for the Zaurus
to make OM/Pi working properly.
To get the character conversion in OM/Pi working, please download
at the sourceforge project site the package
sr-character-conversion_SharpROM_arm.ipk.zip
(or oz-character-conversion_OZ-gcc3xx_arm.ipk.zip for OZ roms)
from the section "general files for KDE/Pim"
Instructions how to install this package are in a ReadMe in this file.
Fixed the orientation change problem in KA/Pi when switching
portrait/landscape mode.
French translation available for KA/Pi and OM/Pi.
Fixed some problems with categories in KO/Pi in DTM sync.
Added selection dialog for export to phone in KA/Pi.
If in KO/Pi is an attendee selected to add to a meeting and this
attendee is already in the list of attendees, this person is not added
again.
Some menu cleanup in KA/Pi.
********** VERSION 1.9.12 ************
Fix for the bug in KO/Pi What's Next view of version 1.9.11.
Bugfix: Licence file is now shown again.
OM/Pi now supports Unicode (utf8 charset).
Fixed some bugs in OM/Pi.
KA/Pi has more German translation.
********** VERSION 1.9.11 ************
Fixed several problems in PWM/Pi, like
asking the user, if unsaved changed are pending
when closing the app.
And PwM/Pi handles now different texts for the
fields Description, Username, Password, configurable per category.
Fixed a crash in KO/Pi , when importing/loading vcs files
which have an entry with an attendee with state:
NEEDS ACTION
Fixed some problems in the German translation of OM/Pi,
which makes some dialogs not fitting on the screen
of the Z 5500.
Fixed Qtopia crash, when disabling/deinstalling
KO/Pi alarm applet.
Implemented direct KDE<->KA/Pi sync for KA/Pi running
on Linux desktop.
Added feature "remove sync info" to sync menu.
Tweaked the KO/Pi What's next view a bit, added
setting to hide events that are done.
Disabled "beam receive enabled" on startup to
avoid problems if Fastload is enabled.
Please set "beam receive enabled",
if you want to receive data via IR.
Fixed bug in direct KDE<->KO/Pi sync for KO/Pi running
on Linux desktop.
Made in KA/Pi scrolling possible, if details view is selected.
(The keyboard focus is set automatically to the search line)
Fixed a bug in DMT sync, that a new entry in DTM was added
on every sync to Kx/Pi.
Fixed missing writing of KA/Pi categories to DMT entries when syncing.
Fixed a bug in DMT sync with todos created in KO/Pi containing
non-latin1 characters.
Rearranged package contents of Sharp-ipks and made all
packages installable on SD again.
Fixed the writing of addressbook data in DTM sync.
Empty fields in KA/Pi were not removed.
Added better category handling in KA/Pi:
Added item
Edit Categories and
Manage new categories
to the settings menu.
Possible to configure a view to display categories.
Added detailed "KDE Sync Howto" and "Multi Sync Howto" to Help menu.
Fixed displaying of "free" days and time in KO Monthview and Agendaview.
... and many other bugfixes.
********** VERSION 1.9.10 ************
Many internal small bugfixes.
And fix of the "big" bug in KO/Pi,
that after Syncing the appointments had an offset by several hours.
That was a problem with the internal timezone setting,
introduced by the changed timezone configuration settings.
German translation for OM/Pi is now available.
********** VERSION 1.9.9 ************
KDE-Pim/Pi has a new Member!
It is called PWM/Pi (Passwordmanager/platform-independent)
and it is available for the Zaurus.
It is planned, that it will be available later for Windows.
(And for Linux, of course).
It is a port of the Passwordmanager of KDE.
It will need the MicroKDElibs to run.
Made loading of addressbooks in KA/Pi up to 7 times faster!
The bigger your addressbook file, the more starting speed
will you gain. (relatively)
The Qtopia addressbook connector is now platform independend
as well and should work on any platform for importing/exporting
Qtopia and Opie XML files.
Added a +30min feature to the timezone settings to make
KDE-Pim/Pi useable in Australia and other parts on the
world with strange timezones ;-)
German "Umlaute" should now be sorted correctly on the Z in KA/Pi.
It is now possible to disable the
"receive data via infrared" feature, such that syncing with
Outlook is now possible again with Kx/Pi runing.
Please disable it, before syncing Sharp DTM with Outlook.
For your convenience, the "receive data via infrared" feature
is disabled automatically, if you sync Kx/Pi with DTM.
You have to enable it again manually after syncing.
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index b7edccd..f6bdda4 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -598,384 +598,385 @@ void KABCore::createAboutData()
about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) );
about->addAuthor( "Cornelius Schumacher",
I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ),
"schumacher@kde.org" );
about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ),
"mpilone@slac.com" );
about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) );
about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) );
about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ),
"michel@klaralvdalens-datakonsult.se" );
about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ),
"hansen@kde.org" );
return about;
#endif //KAB_EMBEDDED
QString version;
#include <../version>
QMessageBox::about( this, "About KAddressbook/Pi",
"KAddressbook/Platform-independent\n"
"(KA/Pi) " +version + " - " +
#ifdef DESKTOP_VERSION
"Desktop Edition\n"
#else
"PDA-Edition\n"
"for: Zaurus 5500 / 7x0 / 8x0\n"
#endif
"(c) 2004 Ulf Schenk\n"
"(c) 2004 Lutz Rogowski\n"
"(c) 1997-2003, The KDE PIM Team\n"
"Tobias Koenig Current maintainer\ntokoe@kde.org\n"
"Don Sanders Original author\n"
"Cornelius Schumacher Co-maintainer\nschumacher@kde.org\n"
"Mike Pilone GUI and framework redesign\nmpilone@slac.com\n"
"Greg Stern DCOP interface\n"
"Mark Westcot Contact pinning\n"
"Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n"
"Steffen Hansen LDAP Lookup\nhansen@kde.org\n"
#ifdef _WIN32_
"(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n"
#endif
);
}
void KABCore::setContactSelected( const QString &uid )
{
KABC::Addressee addr = mAddressBook->findByUid( uid );
if ( !mDetails->isHidden() )
mDetails->setAddressee( addr );
if ( !addr.isEmpty() ) {
emit contactSelected( addr.formattedName() );
KABC::Picture pic = addr.photo();
if ( pic.isIntern() ) {
//US emit contactSelected( pic.data() );
//US instead use:
QPixmap px;
if (pic.data().isNull() != true)
{
px.convertFromImage(pic.data());
}
emit contactSelected( px );
}
}
mExtensionManager->setSelectionChanged();
// update the actions
bool selected = !uid.isEmpty();
if ( mReadWrite ) {
mActionCut->setEnabled( selected );
mActionPaste->setEnabled( selected );
}
mActionCopy->setEnabled( selected );
mActionDelete->setEnabled( selected );
mActionEditAddressee->setEnabled( selected );
mActionMail->setEnabled( selected );
mActionMailVCard->setEnabled( selected );
//if (mActionBeam)
//mActionBeam->setEnabled( selected );
mActionWhoAmI->setEnabled( selected );
}
void KABCore::sendMail()
{
sendMail( mViewManager->selectedEmails().join( ", " ) );
}
void KABCore::sendMail( const QString& emaillist )
{
// the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... "
if (emaillist.contains(",") > 0)
ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null );
else
ExternalAppHandler::instance()->mailToOneContact( emaillist );
}
void KABCore::mailVCard()
{
QStringList uids = mViewManager->selectedUids();
if ( !uids.isEmpty() )
mailVCard( uids );
}
void KABCore::mailVCard( const QStringList& uids )
{
QStringList urls;
// QString tmpdir = locateLocal("tmp", KGlobal::getAppName());
QString dirName = "/tmp/" + KApplication::randomString( 8 );
QDir().mkdir( dirName, true );
for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
KABC::Addressee a = mAddressBook->findByUid( *it );
if ( a.isEmpty() )
continue;
QString name = a.givenName() + "_" + a.familyName() + ".vcf";
QString fileName = dirName + "/" + name;
QFile outFile(fileName);
if ( outFile.open(IO_WriteOnly) ) { // file opened successfully
KABC::VCardConverter converter;
QString vcard;
converter.addresseeToVCard( a, vcard );
QTextStream t( &outFile ); // use a text stream
t.setEncoding( QTextStream::UnicodeUTF8 );
t << vcard;
outFile.close();
urls.append( fileName );
}
}
bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") );
/*US
kapp->invokeMailer( QString::null, QString::null, QString::null,
QString::null, // subject
QString::null, // body
QString::null,
urls ); // attachments
*/
}
/**
Beams the "WhoAmI contact.
*/
void KABCore::beamMySelf()
{
KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI();
if (!a.isEmpty())
{
QStringList uids;
uids << a.uid();
beamVCard(uids);
} else {
KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) );
}
}
void KABCore::updateMainWindow()
{
mMainWindow->showMaximized();
mMainWindow->update();
}
void KABCore::resizeEvent(QResizeEvent* e )
{
if ( !mMiniSplitter )
return;
+ //qDebug("KABCore::resizeEvent(QResizeEvent* e ) ");
if ( QApplication::desktop()->width() >= 480 ) {
if (QApplication::desktop()->width() == 640 ) { // e.g. 640x480
if ( mMiniSplitter->orientation() == Qt::Vertical ) {
mMiniSplitter->setOrientation( Qt::Horizontal);
mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
if ( QApplication::desktop()->width() <= 640 ) {
//mMainWindow->setMaximumSize( QApplication::desktop()->size() );
mViewManager->getFilterAction()->setComboWidth( 150 );
QTimer::singleShot( 1, this , SLOT ( updateMainWindow()));
}
}
} else if (QApplication::desktop()->width() == 480 ){// e.g. 480x640
if ( mMiniSplitter->orientation() == Qt::Horizontal ) {
mMiniSplitter->setOrientation( Qt::Vertical );
mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
if ( QApplication::desktop()->width() <= 640 ) {
//mMainWindow->setMaximumSize( QApplication::desktop()->size() );
mMainWindow->showMinimized();
mViewManager->getFilterAction()->setComboWidth( 0 );
QTimer::singleShot( 1, this , SLOT ( updateMainWindow()));
}
}
}
}
}
void KABCore::export2phone()
{
QStringList uids;
XXPortSelectDialog dlg( this, false, this );
if ( dlg.exec() )
uids = dlg.uids();
else
return;
if ( uids.isEmpty() )
return;
// qDebug("count %d ", uids.count());
KAex2phonePrefs ex2phone;
ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
if ( !ex2phone.exec() ) {
return;
}
KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
KPimGlobalPrefs::instance()->mEx2PhoneConnection,
KPimGlobalPrefs::instance()->mEx2PhoneModel );
QString fileName = getPhoneFile();
if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) )
return;
message(i18n("Exporting to phone..."));
QTimer::singleShot( 1, this , SLOT ( writeToPhone()));
}
QString KABCore::getPhoneFile()
{
#ifdef DESKTOP_VERSION
return locateLocal("tmp", "phonefile.vcf");
#else
return "/tmp/phonefile.vcf";
#endif
}
void KABCore::writeToPhone( )
{
if ( PhoneAccess::writeToPhone( getPhoneFile() ) )
message(i18n("Export to phone finished!"));
else
qDebug(i18n("Error exporting to phone"));
}
void KABCore::beamVCard()
{
QStringList uids;
XXPortSelectDialog dlg( this, false, this );
if ( dlg.exec() )
uids = dlg.uids();
else
return;
if ( uids.isEmpty() )
return;
beamVCard( uids );
}
void KABCore::beamVCard(const QStringList& uids)
{
// LR: we should use the /tmp dir on the Zaurus,
// because: /tmp = RAM, (HOME)/kdepim = flash memory
#ifdef DESKTOP_VERSION
QString fileName = locateLocal("tmp", "kapibeamfile.vcf");
#else
QString fileName = "/tmp/kapibeamfile.vcf";
#endif
KABC::VCardConverter converter;
QString description;
QString datastream;
for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
KABC::Addressee a = mAddressBook->findByUid( *it );
if ( a.isEmpty() )
continue;
if (description.isEmpty())
description = a.formattedName();
QString vcard;
converter.addresseeToVCard( a, vcard );
int start = 0;
int next;
while ( (next = vcard.find("TYPE=", start) )>= 0 ) {
int semi = vcard.find(";", next);
int dopp = vcard.find(":", next);
int sep;
if ( semi < dopp && semi >= 0 )
sep = semi ;
else
sep = dopp;
datastream +=vcard.mid( start, next - start);
datastream +=vcard.mid( next+5,sep -next -5 ).upper();
start = sep;
}
datastream += vcard.mid( start,vcard.length() );
}
#ifndef DESKTOP_VERSION
QFile outFile(fileName);
if ( outFile.open(IO_WriteOnly) ) {
datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" );
QTextStream t( &outFile ); // use a text stream
//t.setEncoding( QTextStream::UnicodeUTF8 );
t.setEncoding( QTextStream::Latin1 );
t <<datastream.latin1();
outFile.close();
Ir *ir = new Ir( this );
connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) );
ir->send( fileName, description, "text/x-vCard" );
} else {
qDebug("Error open temp beam file ");
return;
}
#endif
}
void KABCore::beamDone( Ir *ir )
{
#ifndef DESKTOP_VERSION
delete ir;
#endif
topLevelWidget()->raise();
message( i18n("Beaming finished!") );
}
void KABCore::browse( const QString& url )
{
#ifndef KAB_EMBEDDED
kapp->invokeBrowser( url );
#else //KAB_EMBEDDED
qDebug("KABCore::browse must be fixed");
#endif //KAB_EMBEDDED
}
void KABCore::selectAllContacts()
{
mViewManager->setSelected( QString::null, true );
}
void KABCore::deleteContacts()
{
QStringList uidList = mViewManager->selectedUids();
deleteContacts( uidList );
}
void KABCore::deleteContacts( const QStringList &uids )
{
if ( uids.count() > 0 ) {
PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids );
UndoStack::instance()->push( command );
RedoStack::instance()->clear();
@@ -2003,389 +2004,391 @@ void KABCore::initActions()
mActionManageCategories= new KAction( i18n( "Manage new categories..." ), 0, this,
SLOT( manageCategories() ), actionCollection(),
"remove_voice" );
mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this,
SLOT( importFromOL() ), actionCollection(),
"import_OL" );
#ifdef KAB_EMBEDDED
mActionLicence = new KAction( i18n( "Licence" ), 0,
this, SLOT( showLicence() ), actionCollection(),
"licence_about_data" );
mActionFaq = new KAction( i18n( "Faq" ), 0,
this, SLOT( faq() ), actionCollection(),
"faq_about_data" );
mActionWN = new KAction( i18n( "What's New?" ), 0,
this, SLOT( whatsnew() ), actionCollection(),
"wn" );
mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0,
this, SLOT( synchowto() ), actionCollection(),
"sync" );
mActionKdeSyncHowto = new KAction( i18n( "Kde Sync HowTo" ), 0,
this, SLOT( kdesynchowto() ), actionCollection(),
"kdesync" );
mActionMultiSyncHowto = new KAction( i18n( "Multi Sync HowTo" ), 0,
this, SLOT( multisynchowto() ), actionCollection(),
"multisync" );
mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0,
this, SLOT( createAboutData() ), actionCollection(),
"kaddressbook_about_data" );
#endif //KAB_EMBEDDED
clipboardDataChanged();
connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
}
//US we need this function, to plug all actions into the correct menues.
// KDE uses a XML format to plug the actions, but we work her without this overhead.
void KABCore::addActionsManually()
{
//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
#ifdef KAB_EMBEDDED
QPopupMenu *fileMenu = new QPopupMenu( this );
QPopupMenu *editMenu = new QPopupMenu( this );
QPopupMenu *helpMenu = new QPopupMenu( this );
KToolBar* tb = mMainWindow->toolBar();
#ifndef DESKTOP_VERSION
if ( KABPrefs::instance()->mFullMenuBarVisible ) {
#endif
QMenuBar* mb = mMainWindow->menuBar();
//US setup menubar.
//Disable the following block if you do not want to have a menubar.
mb->insertItem( i18n("&File"), fileMenu );
mb->insertItem( i18n("&Edit"), editMenu );
mb->insertItem( i18n("&View"), viewMenu );
mb->insertItem( i18n("&Settings"), settingsMenu );
mb->insertItem( i18n("Synchronize"), syncMenu );
//mb->insertItem( i18n("&Change"), changeMenu );
mb->insertItem( i18n("&Help"), helpMenu );
mIncSearchWidget = new IncSearchWidget( tb );
// tb->insertWidget(-1, 0, mIncSearchWidget);
#ifndef DESKTOP_VERSION
} else {
//US setup toolbar
QPEMenuBar *menuBarTB = new QPEMenuBar( tb );
QPopupMenu *popupBarTB = new QPopupMenu( this );
menuBarTB->insertItem( "ME", popupBarTB);
tb->insertWidget(-1, 0, menuBarTB);
mIncSearchWidget = new IncSearchWidget( tb );
tb->enableMoving(false);
popupBarTB->insertItem( i18n("&File"), fileMenu );
popupBarTB->insertItem( i18n("&Edit"), editMenu );
popupBarTB->insertItem( i18n("&View"), viewMenu );
popupBarTB->insertItem( i18n("&Settings"), settingsMenu );
popupBarTB->insertItem( i18n("Synchronize"), syncMenu );
mViewManager->getFilterAction()->plug ( popupBarTB);
//popupBarTB->insertItem( i18n("&Change selected"), changeMenu );
popupBarTB->insertItem( i18n("&Help"), helpMenu );
if (QApplication::desktop()->width() > 320 ) {
// mViewManager->getFilterAction()->plug ( tb);
}
}
#endif
// mActionQuit->plug ( mMainWindow->toolBar());
//US Now connect the actions with the menue entries.
mActionPrint->plug( fileMenu );
mActionMail->plug( fileMenu );
fileMenu->insertSeparator();
mActionNewContact->plug( fileMenu );
mActionNewContact->plug( tb );
mActionEditAddressee->plug( fileMenu );
// if ((KGlobal::getDesktopSize() > KGlobal::Small ) ||
// (!KABPrefs::instance()->mMultipleViewsAtOnce ))
mActionEditAddressee->plug( tb );
fileMenu->insertSeparator();
mActionSave->plug( fileMenu );
fileMenu->insertItem( "&Import", ImportMenu );
fileMenu->insertItem( "&Export", ExportMenu );
fileMenu->insertItem( i18n("&Change"), changeMenu );
#ifndef DESKTOP_VERSION
if ( Ir::supported() ) fileMenu->insertItem( i18n("&Beam"), beamMenu );
#endif
fileMenu->insertSeparator();
mActionMailVCard->plug( fileMenu );
#ifndef DESKTOP_VERSION
if ( Ir::supported() ) mActionBR->plug( beamMenu );
if ( Ir::supported() ) mActionBeamVCard->plug( beamMenu );
if ( Ir::supported() ) mActionBeam->plug( beamMenu );
#endif
fileMenu->insertSeparator();
mActionQuit->plug( fileMenu );
#ifdef _WIN32_
mActionImportOL->plug( ImportMenu );
#endif
// edit menu
mActionUndo->plug( editMenu );
mActionRedo->plug( editMenu );
editMenu->insertSeparator();
mActionCut->plug( editMenu );
mActionCopy->plug( editMenu );
mActionPaste->plug( editMenu );
mActionDelete->plug( editMenu );
editMenu->insertSeparator();
mActionSelectAll->plug( editMenu );
mActionRemoveVoice->plug( changeMenu );
// settings menu
//US special menuentry to configure the addressbook resources. On KDE
// you do that through the control center !!!
mActionConfigResources->plug( settingsMenu );
settingsMenu->insertSeparator();
mActionConfigKAddressbook->plug( settingsMenu );
if ( mIsPart ) {
//US not implemented yet
//mActionConfigShortcuts->plug( settingsMenu );
//mActionConfigureToolbars->plug( settingsMenu );
} else {
//US not implemented yet
//mActionKeyBindings->plug( settingsMenu );
}
settingsMenu->insertSeparator();
mActionJumpBar->plug( settingsMenu );
mActionDetails->plug( settingsMenu );
//if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop )
mActionDetails->plug( tb );
settingsMenu->insertSeparator();
#ifndef DESKTOP_VERSION
if ( Ir::supported() ) mActionBR->plug(settingsMenu );
#endif
settingsMenu->insertSeparator();
mActionWhoAmI->plug( settingsMenu );
mActionEditCategories->plug( settingsMenu );
mActionEditCategories->plug( changeMenu );
mActionCategories->plug( changeMenu );
mActionManageCategories->plug( changeMenu );
mActionCategories->plug( settingsMenu );
mActionManageCategories->plug( settingsMenu );
mActionWN->plug( helpMenu );
mActionSyncHowto->plug( helpMenu );
mActionKdeSyncHowto->plug( helpMenu );
mActionMultiSyncHowto->plug( helpMenu );
mActionFaq->plug( helpMenu );
mActionLicence->plug( helpMenu );
mActionAboutKAddressbook->plug( helpMenu );
if (KGlobal::getDesktopSize() > KGlobal::Small ) {
mActionSave->plug( tb );
mViewManager->getFilterAction()->plug ( tb);
- if (KGlobal::getDesktopSize() == KGlobal::Desktop ) {
- mActionUndo->plug( tb );
- mActionDelete->plug( tb );
- mActionRedo->plug( tb );
+ //LR hide filteraction on started in 480x640
+ if (QApplication::desktop()->width() == 480 ) {
+ mViewManager->getFilterAction()->setComboWidth( 0 );
}
+ mActionUndo->plug( tb );
+ mActionDelete->plug( tb );
+ mActionRedo->plug( tb );
} else {
mActionSave->plug( tb );
tb->enableMoving(false);
}
//mActionQuit->plug ( tb );
// tb->insertWidget(-1, 0, mIncSearchWidget, 6);
//US link the searchwidget first to this.
// The real linkage to the toolbar happens later.
//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE);
//US tb->insertItem( mIncSearchWidget );
/*US
mIncSearchWidget = new IncSearchWidget( tb );
connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
SLOT( incrementalSearch( const QString& ) ) );
mJumpButtonBar = new JumpButtonBar( this, this );
//US topLayout->addWidget( mJumpButtonBar );
this->layout()->add( mJumpButtonBar );
*/
#endif //KAB_EMBEDDED
mActionExport2phone->plug( ExportMenu );
connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) );
syncManager->fillSyncMenu();
}
void KABCore::showLicence()
{
KApplication::showLicence();
}
void KABCore::manageCategories( )
{
KABCatPrefs* cp = new KABCatPrefs();
cp->show();
int w =cp->sizeHint().width() ;
int h = cp->sizeHint().height() ;
int dw = QApplication::desktop()->width();
int dh = QApplication::desktop()->height();
cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
if ( !cp->exec() ) {
delete cp;
return;
}
int count = 0;
message( i18n("Please wait, processing categories..."));
if ( cp->addCat() ) {
KABC::AddressBook::Iterator it;
QStringList catList = KABPrefs::instance()->mCustomCategories;
for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
QStringList catIncList = (*it).categories();
int i;
for( i = 0; i< catIncList.count(); ++i ) {
if ( !catList.contains (catIncList[i])) {
catList.append( catIncList[i] );
//qDebug("add cat %s ", catIncList[i].latin1());
++count;
}
}
}
catList.sort();
KABPrefs::instance()->mCustomCategories = catList;
KABPrefs::instance()->writeConfig();
message(QString::number( count )+ i18n(" categories added to list! "));
} else {
QStringList catList = KABPrefs::instance()->mCustomCategories;
QStringList catIncList;
QStringList newCatList;
KABC::AddressBook::Iterator it;
for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
QStringList catIncList = (*it).categories();
int i;
if ( catIncList.count() ) {
newCatList.clear();
for( i = 0; i< catIncList.count(); ++i ) {
if ( catList.contains (catIncList[i])) {
newCatList.append( catIncList[i] );
}
}
newCatList.sort();
(*it).setCategories( newCatList );
mAddressBook->insertAddressee( (*it) );
}
}
setModified( true );
mViewManager->refreshView();
mDetails->refreshView();
message( i18n("Removing categories done!"));
}
delete cp;
}
void KABCore::removeVoice()
{
if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No )
return;
KABC::Addressee::List list;
XXPortSelectDialog dlg( this, false, this );
if ( dlg.exec() )
list = dlg.contacts();
else
return;
KABC::Addressee::List::Iterator it;
for ( it = list.begin(); it != list.end(); ++it ) {
if ( (*it).removeVoice() )
contactModified((*it) );
}
}
void KABCore::clipboardDataChanged()
{
if ( mReadWrite )
mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() );
}
void KABCore::updateActionMenu()
{
UndoStack *undo = UndoStack::instance();
RedoStack *redo = RedoStack::instance();
if ( undo->isEmpty() )
mActionUndo->setText( i18n( "Undo" ) );
else
mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) );
mActionUndo->setEnabled( !undo->isEmpty() );
if ( !redo->top() )
mActionRedo->setText( i18n( "Redo" ) );
else
mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) );
mActionRedo->setEnabled( !redo->isEmpty() );
}
void KABCore::configureKeyBindings()
{
#ifndef KAB_EMBEDDED
KKeyDialog::configure( actionCollection(), true );
#else //KAB_EMBEDDED
qDebug("KABCore::configureKeyBindings() not implemented");
#endif //KAB_EMBEDDED
}
#ifdef KAB_EMBEDDED
void KABCore::configureResources()
{
KRES::KCMKResources dlg( this, "" , 0 );
if ( !dlg.exec() )
return;
KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") );
}
#endif //KAB_EMBEDDED
/* this method will be called through the QCop interface from Ko/Pi to select addresses
* for the attendees list of an event.
*/
void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid)
{
QStringList nameList;
QStringList emailList;
QStringList uidList;
KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this);
uint i=0;
for (i=0; i < list.count(); i++)
{
nameList.append(list[i].realName());
emailList.append(list[i].preferredEmail());
uidList.append(list[i].uid());
}
bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList);
}
/* this method will be called through the QCop interface from Ko/Pi to select birthdays
* to put them into the calendar.
*/
void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid)
{
// qDebug("KABCore::requestForBirthdayList");
QStringList birthdayList;
QStringList anniversaryList;
diff --git a/kaddressbook/viewmanager.cpp b/kaddressbook/viewmanager.cpp
index 0d91c12..33bef5a 100644
--- a/kaddressbook/viewmanager.cpp
+++ b/kaddressbook/viewmanager.cpp
@@ -1,301 +1,305 @@
/*
This file is part of KAddressBook.
Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#ifndef KAB_EMBEDDED
#include <libkdepim/kvcarddrag.h>
#include <kabc/vcardconverter.h>
#include <kconfig.h>
#include <kdeversion.h>
#include <kiconloader.h>
#include <klocale.h>
#include <kmessagebox.h>
#include <kmultipledrag.h>
#include <ktrader.h>
#include <kurldrag.h>
#include "addresseeutil.h"
#else //KAB_EMBEDDED
#include "views/kaddressbookiconview.h"
#include "views/kaddressbooktableview.h"
#include "views/kaddressbookcardview.h"
#include "kaddressbookview.h"
#include <qaction.h>
#include <qmessagebox.h>
#include <qpopupmenu.h>
#include <kconfigbase.h>
#endif //KAB_EMBEDDED
#include <kdebug.h>
#include <kactionclasses.h>
#include <qlayout.h>
+#include <qapplication.h>
#include <qwidgetstack.h>
#include <kabc/addressbook.h>
#include "filtereditdialog.h"
#include "addviewdialog.h"
#include "kabcore.h"
#include "kabprefs.h"
#include "viewmanager.h"
ViewManager::ViewManager( KABCore *core, QWidget *parent, const char *name )
: QWidget( parent, name ), mCore( core ), mActiveView( 0 )
{
initGUI();
initActions();
mViewDict.setAutoDelete( true );
createViewFactories();
}
ViewManager::~ViewManager()
{
unloadViews();
mViewFactoryDict.clear();
}
void ViewManager::scrollUP()
{
if ( mActiveView )
mActiveView->scrollUP();
}
void ViewManager::scrollDOWN()
{
if ( mActiveView )
mActiveView->scrollDOWN();
}
void ViewManager::restoreSettings()
{
mViewNameList = KABPrefs::instance()->mViewNames;
QString activeViewName = KABPrefs::instance()->mCurrentView;
mActionSelectView->setItems( mViewNameList );
// Filter
mFilterList = Filter::restore( mCore->config(), "Filter" );
mActionSelectFilter->setItems( filterNames() );
mActionSelectFilter->setCurrentItem( KABPrefs::instance()->mCurrentFilter );
- mActionSelectFilter->setComboWidth( 150 );
+ int cw = 150;
+ if (QApplication::desktop()->width() == 480 )
+ cw = 0;
+ mActionSelectFilter->setComboWidth( cw );
// Tell the views to reread their config, since they may have
// been modified by global settings
QString _oldgroup = mCore->config()->group();
QDictIterator<KAddressBookView> it( mViewDict );
for ( it.toFirst(); it.current(); ++it ) {
KConfigGroupSaver saver( mCore->config(), it.currentKey() );
it.current()->readConfig( mCore->config() );
}
setActiveView( activeViewName );
mActionDeleteView->setEnabled( mViewNameList.count() > 1 );
}
void ViewManager::saveSettings()
{
QString _oldgroup = mCore->config()->group();
QDictIterator<KAddressBookView> it( mViewDict );
for ( it.toFirst(); it.current(); ++it ) {
KConfigGroupSaver saver( mCore->config(), it.currentKey() );
#ifdef DESKTOP_VERSION
(*it)->writeConfig( mCore->config() );
#else
(*it).writeConfig( mCore->config() );
#endif
}
Filter::save( mCore->config(), "Filter", mFilterList );
KABPrefs::instance()->mCurrentFilter = mActionSelectFilter->currentItem();
// write the view name list
KABPrefs::instance()->mViewNames = mViewNameList;
KABPrefs::instance()->mCurrentView = mActiveView->caption();
}
QStringList ViewManager::selectedUids() const
{
if ( mActiveView )
return mActiveView->selectedUids();
else
return QStringList();
}
QStringList ViewManager::selectedEmails() const
{
if ( mActiveView )
return mActiveView->selectedEmails();
else
return QStringList();
}
KABC::Addressee::List ViewManager::selectedAddressees() const
{
KABC::Addressee::List list;
if ( mActiveView ) {
QStringList uids = mActiveView->selectedUids();
QStringList::Iterator it;
for ( it = uids.begin(); it != uids.end(); ++it ) {
KABC::Addressee addr = mCore->addressBook()->findByUid( *it );
if ( !addr.isEmpty() )
list.append( addr );
}
}
return list;
}
//US added another method with no parameter, since my moc compiler does not support default parameters.
void ViewManager::setSelected()
{
setSelected( QString::null, true );
}
void ViewManager::setSelected( const QString &uid, bool selected )
{
if ( mActiveView )
mActiveView->setSelected( uid, selected );
}
void ViewManager::setListSelected(QStringList list)
{
int i, count = list.count();
for ( i = 0; i < count;++i )
setSelected( list[i], true );
}
void ViewManager::unloadViews()
{
mViewDict.clear();
mActiveView = 0;
}
void ViewManager::setActiveView( const QString &name )
{
KAddressBookView *view = 0;
// Check that this isn't the same as the current active view
if ( mActiveView && ( mActiveView->caption() == name ) )
return;
// At this point we know the view that should be active is not
// currently active. We will try to find the new on in the list. If
// we can't find it, it means it hasn't been instantiated, so we will
// create it on demand.
view = mViewDict.find( name );
// Check if we found the view. If we didn't, then we need to create it
if ( view == 0 ) {
KConfig *config = mCore->config();
KConfigGroupSaver saver( config, name );
QString type = config->readEntry( "Type", "Table" );
kdDebug(5720) << "ViewManager::setActiveView: creating view - " << name << endl;
ViewFactory *factory = mViewFactoryDict.find( type );
if ( factory )
view = factory->view( mCore->addressBook(), mViewWidgetStack );
if ( view ) {
view->setCaption( name );
mViewDict.insert( name, view );
//US my version needs an int as second parameter to addWidget
mViewWidgetStack->addWidget( view, -1 );
view->readConfig( config );
// The manager just relays the signals
connect( view, SIGNAL( selected( const QString& ) ),
SIGNAL( selected( const QString & ) ) );
connect( view, SIGNAL( executed( const QString& ) ),
SIGNAL( executed( const QString& ) ) );
connect( view, SIGNAL( deleteRequest( ) ),
SIGNAL( deleteRequest( ) ) );
connect( view, SIGNAL( modified() ), SIGNAL( modified() ) );
connect( view, SIGNAL( dropped( QDropEvent* ) ),
SLOT( dropped( QDropEvent* ) ) );
connect( view, SIGNAL( startDrag() ), SLOT( startDrag() ) );
}
}
// If we found or created the view, raise it and refresh it
if ( view ) {
mActiveView = view;
mViewWidgetStack->raiseWidget( view );
// Set the proper filter in the view. By setting the combo
// box, the activated slot will be called, which will push
// the filter to the view and refresh it.
if ( view->defaultFilterType() == KAddressBookView::None ) {
mActionSelectFilter->setCurrentItem( 0 );
setActiveFilter( 0 );
} else if ( view->defaultFilterType() == KAddressBookView::Active ) {
setActiveFilter( mActionSelectFilter->currentItem() );
} else {
uint pos = filterPosition( view->defaultFilterName() );
mActionSelectFilter->setCurrentItem( pos );
setActiveFilter( pos );
}
//US qDebug("ViewManager::setActiveView 6" );
// Update the inc search widget to show the fields in the new active
// view.
mCore->setSearchFields( mActiveView->fields() );
//US performance optimization. setActiveFilter calls also mActiveView->refresh()
//US mActiveView->refresh();
}
else
{
qDebug("ViewManager::setActiveView: unable to find view" );
kdDebug(5720) << "ViewManager::setActiveView: unable to find view\n";
}
}
//US added another method with no parameter, since my moc compiler does not support default parameters.
void ViewManager::refreshView()
{
refreshView( QString::null );
}
void ViewManager::refreshView( const QString &uid )
{
if ( mActiveView )
mActiveView->refresh( uid );
}
@@ -408,311 +412,314 @@ void ViewManager::addView()
// Check for name conflicts
bool firstConflict = true;
int numTries = 1;
while ( mViewNameList.contains( newName ) > 0 ) {
if ( !firstConflict ) {
newName = newName.left( newName.length() - 4 );
firstConflict = false;
}
newName = QString( "%1 <%2>" ).arg( newName ).arg( numTries );
numTries++;
}
// Add the new one to the list
mViewNameList.append( newName );
// write the view to the config file,
KConfig *config = mCore->config();
config->deleteGroup( newName );
KConfigGroupSaver saver( config, newName );
config->writeEntry( "Type", type );
// try to set the active view
mActionSelectView->setItems( mViewNameList );
mActionSelectView->setCurrentItem( mViewNameList.findIndex( newName ) );
setActiveView( newName );
editView();
mActionDeleteView->setEnabled( mViewNameList.count() > 1 );
}
}
void ViewManager::createViewFactories()
{
#ifndef KAB_EMBEDDED
KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/View" );
KTrader::OfferList::ConstIterator it;
for ( it = plugins.begin(); it != plugins.end(); ++it ) {
if ( !(*it)->hasServiceType( "KAddressBook/View" ) )
continue;
KLibFactory *factory = KLibLoader::self()->factory( (*it)->library().latin1() );
if ( !factory ) {
kdDebug(5720) << "ViewManager::createViewFactories(): Factory creation failed" << endl;
continue;
}
ViewFactory *viewFactory = static_cast<ViewFactory*>( factory );
if ( !viewFactory ) {
kdDebug(5720) << "ViewManager::createViewFactories(): Cast failed" << endl;
continue;
}
mViewFactoryDict.insert( viewFactory->type(), viewFactory );
}
#else //KAB_EMBEDDED
ViewFactory* viewFactory = new IconViewFactory();
mViewFactoryDict.insert( viewFactory->type(), viewFactory );
// qDebug("ViewManager::createViewFactories() Loading factory: %s", viewFactory->type().latin1());
viewFactory = new TableViewFactory();
mViewFactoryDict.insert( viewFactory->type(), viewFactory );
// qDebug("ViewManager::createViewFactories() Loading factory: %s", viewFactory->type().latin1());
viewFactory = new CardViewFactory();
mViewFactoryDict.insert( viewFactory->type(), viewFactory );
// qDebug("ViewManager::createViewFactories() Loading factory: %s", viewFactory->type().latin1());
#endif //KAB_EMBEDDED
}
void ViewManager::dropped( QDropEvent *e )
{
kdDebug(5720) << "ViewManager::dropped: got a drop event" << endl;
#ifndef KAB_EMBEDDED
QString clipText, vcards;
KURL::List urls;
if ( KURLDrag::decode( e, urls) ) {
KURL::List::Iterator it = urls.begin();
int c = urls.count();
if ( c > 1 ) {
QString questionString = i18n( "Import one contact into your addressbook?", "Import %n contacts into your addressbook?", c );
if ( KMessageBox::questionYesNo( this, questionString, i18n( "Import Contacts?" ) ) == KMessageBox::Yes ) {
for ( ; it != urls.end(); ++it )
emit urlDropped( *it );
}
} else if ( c == 1 )
emit urlDropped( *it );
} else if ( KVCardDrag::decode( e, vcards ) ) {
KABC::Addressee addr;
KABC::VCardConverter converter;
QStringList list = QStringList::split( "\r\n\r\n", vcards );
QStringList::Iterator it;
for ( it = list.begin(); it != list.end(); ++it ) {
if ( converter.vCardToAddressee( (*it).stripWhiteSpace(), addr ) ) {
KABC::Addressee a = mCore->addressBook()->findByUid( addr.uid() );
if ( a.isEmpty() ) {
mCore->addressBook()->insertAddressee( addr );
emit modified();
}
}
}
mActiveView->refresh();
}
#else //KAB_EMBEDDED
qDebug("ViewManager::dropped() has to be changed!!" );
#endif //KAB_EMBEDDED
}
void ViewManager::startDrag()
{
kdDebug(5720) << "ViewManager::startDrag: starting to drag" << endl;
#ifndef KAB_EMBEDDED
// Get the list of all the selected addressees
KABC::Addressee::List addrList;
QStringList uidList = selectedUids();
QStringList::Iterator iter;
for ( iter = uidList.begin(); iter != uidList.end(); ++iter )
addrList.append( mCore->addressBook()->findByUid( *iter ) );
KMultipleDrag *drag = new KMultipleDrag( this );
drag->addDragObject( new QTextDrag( AddresseeUtil::addresseesToClipboard(addrList), this ) );
KABC::Addressee::List::Iterator it;
QStringList vcards;
for ( it = addrList.begin(); it != addrList.end(); ++it ) {
QString vcard = QString::null;
KABC::VCardConverter converter;
if ( converter.addresseeToVCard( *it, vcard ) )
vcards.append( vcard );
}
drag->addDragObject( new KVCardDrag( vcards.join( "\r\n" ), this ) );
drag->setPixmap( KGlobal::iconLoader()->loadIcon( "vcard", KIcon::Desktop ) );
drag->dragCopy();
#else //KAB_EMBEDDED
qDebug("ViewManager::startDrag() has to be changed!!" );
#endif //KAB_EMBEDDED
}
void ViewManager::doSearch( const QString& s,KABC::Field *field )
{
if ( mActiveView )
mActiveView->doSearch( s, field );
}
void ViewManager::setActiveFilter( int index )
{
Filter currentFilter;
if ( ( index - 1 ) < 0 )
currentFilter = Filter();
else
currentFilter = mFilterList[ index - 1 ];
// Check if we have a view. Since the filter combo is created before
// the view, this slot could be called before there is a valid view.
if ( mActiveView ) {
mActiveView->setFilter( currentFilter );
mActiveView->refresh();
emit selected( QString::null );
}
}
void ViewManager::configureFilters()
{
FilterDialog dlg( this );
dlg.setFilters( mFilterList );
if ( dlg.exec() )
mFilterList = dlg.filters();
uint pos = mActionSelectFilter->currentItem();
mActionSelectFilter->setItems( filterNames() );
mActionSelectFilter->setCurrentItem( pos );
setActiveFilter( pos );
- mActionSelectFilter->setComboWidth( 150 );
+ int cw = 150;
+ if (QApplication::desktop()->width() == 480 )
+ cw = 0;
+ mActionSelectFilter->setComboWidth( cw );
}
QStringList ViewManager::filterNames() const
{
QStringList names( i18n( "No Filter" ) );
Filter::List::ConstIterator it;
for ( it = mFilterList.begin(); it != mFilterList.end(); ++it )
names.append( (*it).name() );
return names;
}
int ViewManager::filterPosition( const QString &name ) const
{
int pos = 0;
Filter::List::ConstIterator it;
for ( it = mFilterList.begin(); it != mFilterList.end(); ++it, ++pos )
if ( name == (*it).name() )
return pos + 1;
return 0;
}
void ViewManager::initActions()
{
//US <ActionList name="view_loadedviews"/>
//US <Separator/>
#ifdef KAB_EMBEDDED
QPopupMenu *viewmenu = (QPopupMenu*)mCore->getViewMenu();
QPopupMenu *settingsmenu = (QPopupMenu*)mCore->getSettingsMenu();
QPopupMenu *filtermenu = (QPopupMenu*)mCore->getFilterMenu();
#endif //KAB_EMBEDDED
mActionSelectView = new KSelectAction( i18n( "Select View" ), 0, mCore->actionCollection(), "select_view" );
#if KDE_VERSION >= 309
mActionSelectView->setMenuAccelsEnabled( false );
#endif
connect( mActionSelectView, SIGNAL( activated( const QString& ) ),
SLOT( setActiveView( const QString& ) ) );
#ifdef KAB_EMBEDDED
mActionSelectView->plug(viewmenu);
viewmenu->insertSeparator();
#endif //KAB_EMBEDDED
KAction *action;
action = new KAction( i18n( "Modify View..." ), "configure", 0, this,
SLOT( editView() ), mCore->actionCollection(), "view_modify" );
#ifndef KAB_EMBEDDED
action->setWhatsThis( i18n( "By pressing this button a dialog opens that allows you to modify the view of the addressbook. There you can add or remove fields that you want to be shown or hidden in the addressbook like the name for example." ) );
#else //KAB_EMBEDDED
action->plug(viewmenu);
#endif //KAB_EMBEDDED
action = new KAction( i18n( "Add View..." ), "window_new", 0, this,
SLOT( addView() ), mCore->actionCollection(), "view_add" );
#ifndef KAB_EMBEDDED
action->setWhatsThis( i18n( "You can add a new view by choosing one of the dialog that appears after pressing the button. You have to give the view a name, so that you can distinguish between the different views." ) );
#else //KAB_EMBEDDED
action->plug(viewmenu);
#endif //KAB_EMBEDDED
mActionDeleteView = new KAction( i18n( "Delete View" ), "view_remove", 0,
this, SLOT( deleteView() ),
mCore->actionCollection(), "view_delete" );
#ifndef KAB_EMBEDDED
mActionDeleteView->setWhatsThis( i18n( "By pressing this button you can delete the actual view, which you have added before." ) );
#else //KAB_EMBEDDED
mActionDeleteView->plug(viewmenu);
viewmenu->insertSeparator();
#endif //KAB_EMBEDDED
#ifndef KAB_EMBEDDED
action = new KAction( i18n( "Refresh View" ), "reload", 0, this,
SLOT( refreshView(const QString &) ), mCore->actionCollection(),
"view_refresh" );
action->setWhatsThis( i18n( "The view will be refreshed by pressing this button." ) );
#else //KAB_EMBEDDED
action = new KAction( i18n( "Refresh View" ), "reload", 0, this,
SLOT( refreshView()), mCore->actionCollection(),
"view_refresh" );
action->plug(viewmenu);
viewmenu->insertSeparator();
#endif //KAB_EMBEDDED
action = new KAction( i18n( "Edit &Filters..." ), "filter", 0, this,
SLOT( configureFilters() ), mCore->actionCollection(),
"options_edit_filters" );
mActionSelectFilter = new KSelectAction( i18n( "Select Filter" ), "filter", mCore->actionCollection(), "select_filter" );
#if KDE_VERSION >= 309
mActionSelectFilter->setMenuAccelsEnabled( false );
#endif
connect( mActionSelectFilter, SIGNAL( activated( int ) ),
SLOT( setActiveFilter( int ) ) );
#ifdef KAB_EMBEDDED
action->plug(settingsmenu);
mActionSelectFilter->plug(viewmenu);
#endif //KAB_EMBEDDED
}
void ViewManager::initGUI()
{
QHBoxLayout *layout = new QHBoxLayout( this, 0, 0 );
mViewWidgetStack = new QWidgetStack( this );
layout->addWidget( mViewWidgetStack );
}
#ifndef KAB_EMBEDDED
#include "viewmanager.moc"
#endif //KAB_EMBEDDED
diff --git a/kmicromail/libmailwrapper/settings.cpp b/kmicromail/libmailwrapper/settings.cpp
index 04afe7c..19093b1 100644
--- a/kmicromail/libmailwrapper/settings.cpp
+++ b/kmicromail/libmailwrapper/settings.cpp
@@ -1,246 +1,246 @@
#include <stdlib.h>
#include <qdir.h>
//#include <opie2/odebug.h>
#include <kconfig.h>
#include <kstandarddirs.h>
#include "settings.h"
//#include "defines.h"
#define IMAP_PORT "143"
#define IMAP_SSL_PORT "993"
#define SMTP_PORT "25"
#define SMTP_SSL_PORT "465"
#define POP3_PORT "110"
#define POP3_SSL_PORT "995"
#define NNTP_PORT "119"
#define NNTP_SSL_PORT "563"
Settings::Settings()
: QObject()
{
accounts.setAutoDelete( true ); ;
updateAccounts();
//qDebug("++++++++++++++++++new settings ");
}
void Settings::checkDirectory()
{
return;
locateLocal("data", "kopiemail" );
/*
if ( !QDir( (QString) getenv( "HOME" ) + "/Applications/opiemail/" ).exists() ) {
system( "mkdir -p $HOME/Applications/opiemail" );
qDebug("$HOME/Applications/opiemail created ");
}
*/
}
QList<Account> Settings::getAccounts()
{
return accounts;
}
void Settings::addAccount( Account *account )
{
accounts.append( account );
}
void Settings::delAccount( Account *account )
{
- accounts.remove( account );
account->remove();
+ accounts.remove( account );
}
void Settings::updateAccounts()
{
accounts.clear();
QDir dir( locateLocal("data", "kopiemail" ) );
QStringList::Iterator it;
QStringList imap = dir.entryList( "imap-*" );
for ( it = imap.begin(); it != imap.end(); it++ ) {
IMAPaccount *account = new IMAPaccount( (*it).replace(0, 5, "") );
accounts.append( account );
}
QStringList pop3 = dir.entryList( "pop3-*" );
for ( it = pop3.begin(); it != pop3.end(); it++ ) {
POP3account *account = new POP3account( (*it).replace(0, 5, "") );
accounts.append( account );
}
QStringList smtp = dir.entryList( "smtp-*" );
for ( it = smtp.begin(); it != smtp.end(); it++ ) {
SMTPaccount *account = new SMTPaccount( (*it).replace(0, 5, "") );
accounts.append( account );
}
QStringList nntp = dir.entryList( "nntp-*" );
for ( it = nntp.begin(); it != nntp.end(); it++ ) {
NNTPaccount *account = new NNTPaccount( (*it).replace(0, 5, "") );
accounts.append( account );
}
readAccounts();
}
void Settings::saveAccounts()
{
checkDirectory();
Account *it;
for ( it = accounts.first(); it; it = accounts.next() ) {
it->save();
}
}
void Settings::readAccounts()
{
checkDirectory();
Account *it;
for ( it = accounts.first(); it; it = accounts.next() ) {
it->read();
}
}
Account::Account()
{
accountName = "changeMe";
type = MAILLIB::A_UNDEFINED;
ssl = false;
connectionType = 1;
offline = false;
maxMailSize = 0;
lastFetch;
leaveOnServer = false;
}
void Account::remove()
{
QFile file( getFileName() );
file.remove();
}
void Account::setPasswordList(const QStringList &str)
{
password = "";
int i;
for ( i = 0; i < str.count() ; ++i ) {
QChar c ( (str[i].toUInt()-131)/(str.count()- (i%3)));
password.append( c );
}
//qDebug("password %s ", password.latin1());
}
QStringList Account::getPasswordList()
{
int i;
int len = password.length();
QStringList str;
for ( i = 0; i < len ; ++i ) {
int val = password.at(i).unicode()*(len-(i%3))+131;
str.append( QString::number( val ) );
// qDebug("append %s ", str[i].latin1());
}
return str;
}
IMAPaccount::IMAPaccount()
: Account()
{
file = IMAPaccount::getUniqueFileName();
accountName = "New IMAP Account";
ssl = false;
connectionType = 1;
type = MAILLIB::A_IMAP;
port = IMAP_PORT;
}
IMAPaccount::IMAPaccount( QString filename )
: Account()
{
file = filename;
accountName = "New IMAP Account";
ssl = false;
connectionType = 1;
type = MAILLIB::A_IMAP;
port = IMAP_PORT;
}
QString IMAPaccount::getUniqueFileName()
{
int num = 0;
QString unique;
QDir dir( locateLocal("data", "kopiemail" ) );
QStringList imap = dir.entryList( "imap-*" );
do {
unique.setNum( num++ );
} while ( imap.contains( "imap-" + unique ) > 0 );
return unique;
}
void IMAPaccount::read()
{
KConfig *conf = new KConfig( getFileName() );
conf->setGroup( "IMAP Account" );
accountName = conf->readEntry( "Account","" );
if (accountName.isNull()) accountName = "";
server = conf->readEntry( "Server","" );
if (server.isNull()) server="";
port = conf->readEntry( "Port","" );
if (port.isNull()) port="143";
connectionType = conf->readNumEntry( "ConnectionType" );
ssl = conf->readBoolEntry( "SSL",false );
user = conf->readEntry( "User","" );
if (user.isNull()) user = "";
//password = conf->readEntryCrypt( "Password","" );
setPasswordList( conf->readListEntry( "FolderHistory"));
if (password.isNull()) password = "";
prefix = conf->readEntry("MailPrefix","");
if (prefix.isNull()) prefix = "";
offline = conf->readBoolEntry("Offline",false);
localFolder = conf->readEntry( "LocalFolder" );
maxMailSize = conf->readNumEntry( "MaxSize",0 );
int lf = conf->readNumEntry( "LastFetch",0 );
QDateTime dt ( QDate ( 2004, 1, 1 ), QTime( 0,0,0) );
leaveOnServer = conf->readBoolEntry("LeaveOnServer",false);
if ( lf < 0 ) lf = 0;
lastFetch = dt.addSecs( lf );
delete conf;
}
void IMAPaccount::save()
{
Settings::checkDirectory();
KConfig *conf = new KConfig( getFileName() );
conf->setGroup( "IMAP Account" );
conf->writeEntry( "Account", accountName );
conf->writeEntry( "Server", server );
conf->writeEntry( "Port", port );
conf->writeEntry( "SSL", ssl );
conf->writeEntry( "ConnectionType", connectionType );
conf->writeEntry( "User", user );
//conf->writeEntryCrypt( "Password", password );
conf->writeEntry( "FolderHistory",getPasswordList() );
conf->writeEntry( "MailPrefix",prefix);
conf->writeEntry( "Offline",offline);
conf->writeEntry( "LocalFolder", localFolder );
conf->writeEntry( "MaxSize", maxMailSize );
QDateTime dt ( QDate ( 2004, 1, 1 ), QTime( 0,0,0) );
int lf = dt.secsTo ( lastFetch );
conf->writeEntry( "LastFetch", lf );
conf->writeEntry( "LeaveOnServer", leaveOnServer);
conf->sync();
delete conf;
}
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp
index ec192ea..915b3e8 100644
--- a/kmicromail/opiemail.cpp
+++ b/kmicromail/opiemail.cpp
@@ -110,414 +110,441 @@ void OpieMail::slotwriteMail2(const QString& namemail )
{
//qDebug("OpieMail::slotwriteMail2 ");
//qApp->processEvents();
ComposeMail compose( settings, this, 0, true );
if ( !namemail.isEmpty() ) {
QString to = namemail;
if ( namemail.find( " <") > 1 ) {
to = "\"" +to.replace( QRegExp( " <"), "\" <") ;
} else
if ( namemail.find( "<") > 1 ) {
to = "\"" +to.replace( QRegExp( "<"), "\" <") ;
}
int sub = to.find( ">:");
if ( sub > 0 ) {
compose.setTo( to.left(sub+1) );
compose.setSubject( to.mid(sub+2) );
} else
compose.setTo( to );
}
compose.slotAdjustColumns();
#ifndef DESKTOP_VERSION
compose.showMaximized();
#endif
compose.exec();
raise();
//qDebug("retttich ");
}
void OpieMail::slotwriteMail(const QString&name,const QString&email)
{
// qDebug("OpieMail::slotwriteMail ");
ComposeMail compose( settings, this, 0, true );
if (!email.isEmpty())
{
if (!name.isEmpty())
{
compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">");
}
else
{
compose.setTo(email);
}
}
compose.slotAdjustColumns();
#ifndef DESKTOP_VERSION
compose.showMaximized();
#endif
compose.exec();
raise();
}
void OpieMail::slotComposeMail()
{
if ( mPendingEmail == QString::null && mPendingName == QString::null)
slotwriteMail2( QString () );
else {
if ( mPendingEmail == QString::null )
slotwriteMail2( mPendingName );
else
slotwriteMail( mPendingName, mPendingEmail );
}
//slotwriteMail(0l,0l);
}
void OpieMail::slotSendQueued()
{
SMTPaccount *smtp = 0;
QList<Account> list = settings->getAccounts();
QList<SMTPaccount> smtpList;
smtpList.setAutoDelete(false);
Account *it;
for ( it = list.first(); it; it = list.next() )
{
if ( it->getType() == MAILLIB::A_SMTP )
{
smtp = static_cast<SMTPaccount *>(it);
smtpList.append(smtp);
}
}
if (smtpList.count()==0)
{
QMessageBox::information(0,i18n("Info"),i18n("Define a smtp account first!\n"));
return;
}
if ( QMessageBox::warning(this, i18n("Sending all mails"), i18n("Do you really want to send\nall queued mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::No )
return;
if (smtpList.count()==1)
{
smtp = smtpList.at(0);
}
else
{
smtp = 0;
selectsmtp selsmtp;
selsmtp.setSelectionlist(&smtpList);
#ifndef DESKTOP_VERSION
selsmtp.showMaximized();
#endif
if ( selsmtp.exec() == QDialog::Accepted )
{
smtp = selsmtp.selected_smtp();
}
}
if (smtp)
{
Global::statusMessage("Sending mails...!");
SMTPwrapper * wrap = new SMTPwrapper(smtp);
if ( wrap->flushOutbox() )
{
Global::statusMessage("Mails sent!");
}
delete wrap;
}
// pending refresh list view, if outgoing is displayed
}
void OpieMail::slotSearchMails()
{
qDebug("OpieMail::slotSearchMails():not implemented ");
}
void OpieMail::slotEditSettings()
{
KOPrefsDialog settingsDialog( this, "koprefs", true );
#ifndef DESKTOP_VERSION
settingsDialog.showMaximized();
#endif
settingsDialog.exec();
slotSetCodec( KOPrefs::instance()->mCurrentCodec );
// KApplication::execDialog(settingsDialog);
}
void OpieMail::slotEditAccounts()
{
EditAccounts eaDialog( settings, this, 0, true );
eaDialog.slotAdjustColumns();
#ifndef DESKTOP_VERSION
eaDialog.showMaximized();
#endif
eaDialog.exec();
if ( settings ) delete settings;
settings = new Settings();
folderView->populate( settings->getAccounts() );
}
void OpieMail::replyMail()
{
QListViewItem*item = mailView->currentItem();
if (!item) return;
RecMailP mail = ((MailListViewItem*)item)->data();
RecBodyP body = folderView->fetchBody(mail);
QString rtext;
rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose
.arg( mail->getFrom())
.arg( mail->getDate());
QString text = body->Bodytext();
QStringList lines = QStringList::split(QRegExp("\\n"), text);
QStringList::Iterator it;
for (it = lines.begin(); it != lines.end(); it++)
{
rtext += "> " + *it + "\n";
}
rtext += "\n";
QString prefix;
if ( mail->getSubject().find(QRegExp("^Re: .*$")) != -1) prefix = "";
else prefix = "Re: "; // no i18n on purpose
Settings *settings = new Settings();
ComposeMail composer( settings ,this, 0, true);
if (mail->Replyto().isEmpty()) {
composer.setTo( mail->getFrom());
} else {
composer.setTo( mail->Replyto());
}
composer.setSubject( prefix + mail->getSubject());
composer.setMessage( rtext );
composer.setInReplyTo( mail->Msgid());
composer.setCharset( body->getCharset() );
if ( QDialog::Accepted == KApplication::execDialog( &composer ) )
{
mail->Wrapper()->answeredMail(mail);
}
delete settings;
}
+void OpieMail::closeViewMail(ViewMail * vm)
+{
+ vm->hide();
+}
+void OpieMail::deleteAndDisplayNextMail(ViewMail * vm)
+{
+ QListViewItem*item = mailView->currentItem();
+ if (!item ) {
+ closeViewMail(vm);
+ return;
+ }
+ RecMailP mail = ((MailListViewItem*)item)->data();
+ mail->Wrapper()->deleteMail( mail );
+ item = item->itemBelow();
+ if (!item ) {
+ closeViewMail(vm);
+ return;
+ }
+ mailView->setCurrentItem(item);
+ mail = ((MailListViewItem*)item)->data();
+ RecBodyP body = folderView->fetchBody(mail);
+ vm->setBody( body );
+ vm->setMail( mail );
+}
void OpieMail::displayNextMail(ViewMail * vm)
{
QListViewItem*item = mailView->currentItem();
if (!item) return;
+ ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() );
item = item->itemBelow();
if (!item) {
vm->setCaption(i18n("End of List" ));
return;
}
mailView->setCurrentItem(item);
RecMailP mail = ((MailListViewItem*)item)->data();
RecBodyP body = folderView->fetchBody(mail);
vm->setBody( body );
vm->setMail( mail );
}
void OpieMail::displayMail()
{
QListViewItem*item = mailView->currentItem();
if (!item) return;
RecMailP mail = ((MailListViewItem*)item)->data();
RecBodyP body = folderView->fetchBody(mail);
ViewMail readMail( this,"", Qt::WType_Modal );
readMail.setBody( body );
readMail.setMail( mail );
#ifndef DESKTOP_VERSION
readMail.showMaximized();
#else
readMail.resize( 640, 480);
#endif
connect( &readMail,SIGNAL( showNextMail(ViewMail *) ), this, SLOT( displayNextMail(ViewMail *) ) );
+ connect( &readMail,SIGNAL( deleteAndDisplayNextMail(ViewMail *) ), this, SLOT(deleteAndDisplayNextMail(ViewMail *) ) );
+
readMail.exec();
if ( readMail.deleted )
{
folderView->refreshCurrent();
}
else
{
( (MailListViewItem*)item )->setPixmap( 0, QPixmap() );
}
}
void OpieMail::slotGetAllMail()
{
QListViewItem * item = folderView->firstChild();
while ( item ){
((AccountViewItem *)item)->contextMenuSelected( 101 );
item = item->nextSibling ();
}
}
void OpieMail::slotGetMail()
{
QListViewItem * item = folderView->currentItem();
if ( ! item ) return;
((AccountViewItem *)item)->contextMenuSelected( 101 );
}
void OpieMail::slotDeleteMail()
{
if (!mailView->currentItem()) return;
RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data();
if ( QMessageBox::warning(this, i18n("Delete Mail"), QString( i18n("<p>Do you really want to delete this mail? <br><br>" ) + mail->getFrom() + " - " + mail->getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes )
{
mail->Wrapper()->deleteMail( mail );
folderView->refreshCurrent();
}
}
void OpieMail::slotDeleteAllMail()
{
QValueList<RecMailP> t;
if ( QMessageBox::warning(this, i18n("Delete All Mails"), i18n("Do you really want to delete\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes )
{
MailListViewItem* item = (MailListViewItem*)mailView->firstChild ();
while ( item ) {
if ( item->isSelected() ) {
t.append( item->data() );
}
item = (MailListViewItem*)item->nextSibling();
}
}
else
return;
if ( t.count() == 0 )
return;
RecMailP mail = t.first();
mail->Wrapper()->deleteMailList(t);
folderView->refreshCurrent();
}
void OpieMail::clearSelection()
{
mailView->clearSelection();
}
void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int )
{
if (!mailView->currentItem()) return;
MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType();
/* just the RIGHT button - or hold on pda */
if (button!=2) {return;}
if (!item) return;
QPopupMenu *m = new QPopupMenu(0);
if (m)
{
if (mailtype==MAILLIB::A_NNTP) {
m->insertItem(i18n("Read this posting"),this,SLOT(displayMail()));
m->insertItem(i18n("Copy this posting"),this,SLOT(slotMoveCopyMail()));
m->insertSeparator();
m->insertItem(i18n("Copy all selected postings"),this,SLOT(slotMoveCopyAllMail()));
m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection()));
} else {
if (folderView->currentisDraft()) {
m->insertItem(i18n("Edit this mail"),this,SLOT(reEditMail()));
}
m->insertItem(i18n("Reply to this mail"),this,SLOT(replyMail()));
m->insertSeparator();
m->insertItem(i18n("Read this mail"),this,SLOT(displayMail()));
m->insertItem(i18n("Move/Copy this mail"),this,SLOT(slotMoveCopyMail()));
m->insertItem(i18n("Delete this mail"),this,SLOT(slotDeleteMail()));
m->insertSeparator();
m->insertItem(i18n("Move/Copy all selected mail"),this,SLOT(slotMoveCopyAllMail()));
m->insertItem(i18n("Delete all selected mails"),this,SLOT(slotDeleteAllMail()));
m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection()));
}
m->setFocus();
m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) );
delete m;
}
}
void OpieMail::slotShowFolders( bool show )
{
if ( show && folderView->isHidden() )
{
folderView->show();
}
else if ( !show && !folderView->isHidden() )
{
folderView->hide();
}
}
void OpieMail::refreshMailView(const QValueList<RecMailP>&list)
{
MailListViewItem*item = 0;
mailView->clear();
QValueList<RecMailP>::ConstIterator it;
for (it = list.begin(); it != list.end();++it)
{
item = new MailListViewItem(mailView,item);
item->storeData((*it));
item->showEntry();
}
mailView->setSorting ( 4, false );
}
void OpieMail::mailLeftClicked( QListViewItem *item )
{
mailView->clearSelection();
/* just LEFT button - or tap with stylus on pda */
//if (button!=1) return;
if (!item) return;
if (folderView->currentisDraft()) {
reEditMail();
} else {
displayMail();
}
}
void OpieMail::slotMoveCopyMail()
{
if (!mailView->currentItem()) return;
RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data();
AbstractMail*targetMail = 0;
QString targetFolder = "";
Selectstore sels;
folderView->setupFolderselect(&sels);
if (!sels.exec()) return;
targetMail = sels.currentMail();
targetFolder = sels.currentFolder();
if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) ||
targetFolder.isEmpty())
{
return;
}
if (sels.newFolder() && !targetMail->createMbox(targetFolder))
{
QMessageBox::critical(0,i18n("Error creating new Folder"),
i18n("<center>Error while creating<br>new folder - breaking.</center>"));
return;
}
sels.hide();
qApp->processEvents();
// qDebug("hiding sels ");
mail->Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails());
folderView->refreshCurrent();
}
void OpieMail::slotMoveCopyAllMail()
{
if (!mailView->currentItem()) return;
QValueList<RecMailP> t;
// if ( QMessageBox::warning(this, i18n("Move/Copy all selected mails"), i18n("Do you really want to copy/move\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes )
{
MailListViewItem* item = (MailListViewItem*)mailView->firstChild ();
while ( item ) {
if ( item->isSelected() ) {
t.append( item->data() );
}
item = (MailListViewItem*)item->nextSibling();
}
}
// else
// return;
if ( t.count() == 0 )
return;
RecMailP mail = t.first();
AbstractMail*targetMail = 0;
QString targetFolder = "";
diff --git a/kmicromail/opiemail.h b/kmicromail/opiemail.h
index 30968a7..a81a34c 100644
--- a/kmicromail/opiemail.h
+++ b/kmicromail/opiemail.h
@@ -1,58 +1,60 @@
// CHANGED 2004-09-31 Lutz Rogowski
#ifndef OPIEMAIL_H
#define OPIEMAIL_H
#include "mainwindow.h"
#include <libmailwrapper/settings.h>
#include <opie2/osmartpointer.h>
#include <libmailwrapper/mailtypes.h>
#include <viewmail.h>
class OpieMail : public MainWindow
{
Q_OBJECT
public:
OpieMail( QWidget *parent = 0, const char *name = 0 );
virtual ~OpieMail();
static QString appName() { return QString::fromLatin1("kopiemail"); }
public slots:
virtual void slotwriteMail(const QString&name,const QString&email);
virtual void slotwriteMail2(const QString&nameemail);
virtual void slotComposeMail();
virtual void slotExtAppHandler();
virtual void appMessage(const QCString &msg, const QByteArray &data);
virtual void message(const QCString &msg, const QByteArray &data);
protected slots:
+ virtual void deleteAndDisplayNextMail(ViewMail * vm);
virtual void displayNextMail(ViewMail * vm);
virtual void slotSendQueued();
virtual void slotSearchMails();
virtual void slotEditSettings();
virtual void slotEditAccounts();
virtual void displayMail();
virtual void replyMail();
virtual void slotDeleteMail();
virtual void slotGetMail();
virtual void slotGetAllMail();
virtual void slotDeleteAllMail();
virtual void mailHold(int, QListViewItem *,const QPoint&,int);
virtual void slotShowFolders( bool show );
virtual void refreshMailView(const QValueList<RecMailP>&);
virtual void mailLeftClicked( QListViewItem * );
virtual void slotMoveCopyMail();
virtual void slotMoveCopyAllMail();
virtual void reEditMail();
void clearSelection();
private:
+ void closeViewMail(ViewMail * vm);
QString mPendingEmail;
QString mPendingName;
QByteArray mPendingData;
QCString mPendingMessage;
Settings *settings;
};
#endif
diff --git a/kmicromail/viewmail.cpp b/kmicromail/viewmail.cpp
index 60c764c..6d88cad 100644
--- a/kmicromail/viewmail.cpp
+++ b/kmicromail/viewmail.cpp
@@ -317,217 +317,218 @@ void ViewMail::setMail(const RecMailP&mail )
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( closeMail, SIGNAL( activated() ), SLOT( close() ) );
connect( nextMail, SIGNAL( activated() ), SLOT( slotNextMail() ) );
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()
{
setFont ( KOPrefs::instance()->mReadFont );
m_showHtml = KOPrefs::instance()->mViewAsHtml;
showHtml->setOn( m_showHtml );
}
void ViewMail::setText()
{
QString toString;
QString ccString;
QString bccString;
toString = m_mail2[0].join(",");
ccString = m_mail2[1].join(",");
bccString = m_mail2[2].join(",");
setCaption( i18n("E-Mail by %1").arg( m_mail[0] ) );
m_mailHtml = "<html><body>"
"<table width=\"100%\" border=\"0\"><tr bgcolor=\"#FFDD76\"><td>"
"<div align=left><b>" + deHtml( m_mail[1] ) + "</b></div>"
"</td></tr><tr bgcolor=\"#EEEEE6\"><td>"
"<b>" + i18n( "From" ) + ": </b><font color=#6C86C0>" + deHtml( m_mail[0] ) + "</font><br>"
"<b>" + i18n( "To" ) + ": </b><font color=#6C86C0>" + deHtml( toString ) + "</font><br><b>" +
i18n( "Cc" ) + ": </b>" + deHtml( ccString ) + "<br>"
"<b>" + i18n( "Date" ) + ": </b> " + m_mail[3] +
"</td></tr></table><font>";
if ( !m_showHtml )
{
browser->setText( QString( m_mailHtml) + deHtml( m_mail[2] ) + "</font></html>" );
}
else
{
browser->setText( QString( m_mailHtml) + m_mail[2] + "</font></html>" );
}
// remove later in favor of a real handling
m_gotBody = true;
}
ViewMail::~ViewMail()
{
m_recMail->Wrapper()->cleanMimeCache();
hide();
}
void ViewMail::hide()
{
QWidget::hide();
if (_inLoop)
{
_inLoop = false;
qApp->exit_loop();
}
}
void ViewMail::exec()
{
show();
if (!_inLoop)
{
_inLoop = true;
qApp->enter_loop();
}
}
QString ViewMail::deHtml(const QString &string)
{
QString string_ = string;
string_.replace(QRegExp("&"), "&amp;");
string_.replace(QRegExp("<"), "&lt;");
string_.replace(QRegExp(">"), "&gt;");
string_.replace(QRegExp("\\n"), "<br>");
return string_;
}
void ViewMail::slotReply()
{
if (!m_gotBody)
{
QMessageBox::information(this, i18n("Error"), i18n("<p>The mail body is not yet downloaded, so you cannot reply yet."), i18n("Ok"));
return;
}
QString rtext;
rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose
.arg( m_mail[0] )
.arg( m_mail[3] );
QString text = m_mail[2];
QStringList lines = QStringList::split(QRegExp("\\n"), text);
QStringList::Iterator it;
for (it = lines.begin(); it != lines.end(); it++)
{
rtext += "> " + *it + "\n";
}
rtext += "\n";
QString prefix;
if ( m_mail[1].find(QRegExp("^Re: .*$")) != -1) prefix = "";
else prefix = "Re: "; // no i18n on purpose
Settings *settings = new Settings();
ComposeMail composer( settings ,this, 0, true);
if (m_recMail->Replyto().isEmpty()) {
composer.setTo(m_recMail->getFrom());
} else {
composer.setTo(m_recMail->Replyto());
}
composer.setSubject( prefix + m_mail[1] );
composer.setMessage( rtext );
composer.setInReplyTo(m_recMail->Msgid());
composer.setCharset( m_body->getCharset() );
if ( QDialog::Accepted == KApplication::execDialog( &composer ) )
{
m_recMail->Wrapper()->answeredMail(m_recMail);
}
delete settings;
}
void ViewMail::slotForward()
{
if (!m_gotBody)
{
QMessageBox::information(this, i18n("Error"), i18n("<p>The mail body is not yet downloaded, so you cannot forward yet."), i18n("Ok"));
return;
}
QString ftext;
ftext += QString("\n----- Forwarded message from %1 -----\n\n")
.arg( m_mail[0] );
if (!m_mail[3].isNull())
ftext += QString("Date: %1\n")
.arg( m_mail[3] );
if (!m_mail[0].isNull())
ftext += QString("From: %1\n")
.arg( m_mail[0] );
if (!m_mail[1].isNull())
ftext += QString("Subject: %1\n")
.arg( m_mail[1] );
ftext += QString("\n%1\n")
.arg( m_mail[2]);
ftext += QString("----- End forwarded message -----\n");
Settings *settings = new Settings();
ComposeMail composer( settings ,this, 0, true);
composer.setSubject( "Fwd: " + m_mail[1] );
composer.setMessage( ftext );
if ( QDialog::Accepted == KApplication::execDialog( &composer ))
{
}
}
void ViewMail::slotDeleteMail( )
{
if ( QMessageBox::warning(this, i18n("Delete Mail"), QString( i18n("<p>Do you really want to delete this mail? <br><br>" ) + m_mail[0] + " - " + m_mail[1] ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes )
{
- m_recMail->Wrapper()->deleteMail( m_recMail );
- hide();
+ emit deleteAndDisplayNextMail( this);
+ //m_recMail->Wrapper()->deleteMail( m_recMail );
+ //hide();
deleted = true;
}
}
MailImageDlg::MailImageDlg(const QString&fname,QWidget *parent, const char *name, bool modal, WFlags f)
: QDialog(parent,name,modal)
{
QVBoxLayout*dlglayout = new QVBoxLayout(this);
dlglayout->setSpacing(2);
dlglayout->setMargin(1);
//m_imageview = new Opie::MM::OImageScrollView(this);
//dlglayout->addWidget(m_imageview);
}
MailImageDlg::~MailImageDlg()
{
}
void MailImageDlg::setName(const QString&fname)
{
qDebug("viewmail.cpp: MailImageDlg::setName Pending");
// m_imageview->setImage(fname);
}
diff --git a/kmicromail/viewmail.h b/kmicromail/viewmail.h
index c2c2ce3..d85b8b2 100644
--- a/kmicromail/viewmail.h
+++ b/kmicromail/viewmail.h
@@ -1,88 +1,89 @@
#ifndef VIEWMAIL_H
#define VIEWMAIL_H
#include "viewmailbase.h"
#include <libmailwrapper/mailtypes.h>
#include <qdialog.h>
#include <qlistview.h>
#include <qmap.h>
#include <qstringlist.h>
#include <qvaluelist.h>
//namespace Opie { namespace MM { class OImageScrollView; } }
class AttachItem : public QListViewItem
{
public:
AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file,
const QString&fsize,int num,const QValueList<int>&path);
AttachItem(QListViewItem * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file,
const QString&fsize,int num,const QValueList<int>&path);
int Partnumber() { return _partNum; }
bool isParentof(const QValueList<int>&path);
private:
int _partNum;
/* needed for a better display of attachments */
QValueList<int> _path;
};
class ViewMail : public ViewMailBase
{
Q_OBJECT
public:
ViewMail( QWidget *parent = 0, const char *name = 0, WFlags fl = 0);
~ViewMail();
void hide();
void exec();
void setMail(const RecMailP&mail );
void setBody(const RecBodyP&body);
bool deleted;
signals:
void showNextMail(ViewMail*);
+ void deleteAndDisplayNextMail(ViewMail *);
protected:
QString deHtml(const QString &string);
AttachItem* searchParent(const QValueList<int>&path);
AttachItem* lastChild(AttachItem*parent);
protected slots:
void slotNextMail() { emit showNextMail(this); };
void slotReply();
void slotForward();
void setText();
void slotItemClicked( QListViewItem * item , const QPoint & point, int c );
void slotDeleteMail( );
void slotShowHtml( bool );
private:
void readConfig();
bool _inLoop;
QString m_mailHtml;
bool m_gotBody;
RecBodyP m_body;
RecMailP m_recMail;
bool m_showHtml;
// 0 from 1 subject 2 bodytext 3 date
QMap <int,QString> m_mail;
// 0 to 1 cc 2 bcc
QMap <int,QStringList> m_mail2;
};
class MailImageDlg:public QDialog
{
Q_OBJECT
public:
MailImageDlg(const QString&,QWidget *parent = 0, const char *name = 0, bool modal = true, WFlags f = 0);
~MailImageDlg();
void setName(const QString&);
protected:
//Opie::MM::OImageScrollView*m_imageview;
};
#endif
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 15c5dd9..a46cd87 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -2284,618 +2284,620 @@ void CalendarView::removeCategories()
}
}
int CalendarView::addCategories()
{
QPtrList<Incidence> incList = mCalendar->rawIncidences();
QStringList catList = KOPrefs::instance()->mCustomCategories;
QStringList catIncList;
Incidence* inc = incList.first();
int i;
int count = 0;
while ( inc ) {
catIncList = inc->categories() ;
for( i = 0; i< catIncList.count(); ++i ) {
if ( !catList.contains (catIncList[i])) {
catList.append( catIncList[i] );
//qDebug("add cat %s ", catIncList[i].latin1());
++count;
}
}
inc = incList.next();
}
catList.sort();
KOPrefs::instance()->mCustomCategories = catList;
return count;
}
void CalendarView::manageCategories()
{
KOCatPrefs* cp = new KOCatPrefs();
cp->show();
int w =cp->sizeHint().width() ;
int h = cp->sizeHint().height() ;
int dw = QApplication::desktop()->width();
int dh = QApplication::desktop()->height();
cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
if ( !cp->exec() ) {
delete cp;
return;
}
int count = 0;
if ( cp->addCat() ) {
count = addCategories();
if ( count ) {
topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! "));
writeSettings();
} else
topLevelWidget()->setCaption(QString::number( 0 )+ i18n(" Categories added to list! "));
} else {
removeCategories();
updateView();
}
delete cp;
}
void CalendarView::beamIncidence(Incidence * Inc)
{
QPtrList<Incidence> delSel ;
delSel.append(Inc);
beamIncidenceList( delSel );
}
void CalendarView::beamCalendar()
{
QPtrList<Incidence> delSel = mCalendar->rawIncidences();
//qDebug("beamCalendar() ");
beamIncidenceList( delSel );
}
void CalendarView::beamFilteredCalendar()
{
QPtrList<Incidence> delSel = mCalendar->incidences();
//qDebug("beamFilteredCalendar() ");
beamIncidenceList( delSel );
}
void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel )
{
if ( beamDialog->exec () == QDialog::Rejected )
return;
#ifdef DESKTOP_VERSION
QString fn = locateLocal( "tmp", "kopibeamfile" );
#else
QString fn = "/tmp/kopibeamfile";
#endif
QString mes;
bool createbup = true;
if ( createbup ) {
QString description = "\n";
CalendarLocal* cal = new CalendarLocal();
if ( beamDialog->beamLocal() )
cal->setLocalTime();
else
cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
Incidence *incidence = delSel.first();
bool addText = false;
if ( delSel.count() < 10 )
addText = true;
else {
description.sprintf(i18n(" %d items?"),delSel.count() );
}
while ( incidence ) {
Incidence *in = incidence->clone();
if ( ! in->summary().isEmpty() ) {
in->setDescription("");
} else {
in->setSummary( in->description().left(20));
in->setDescription("");
}
if ( addText )
description += in->summary() + "\n";
cal->addIncidence( in );
incidence = delSel.next();
}
if ( beamDialog->beamVcal() ) {
fn += ".vcs";
FileStorage storage( cal, fn, new VCalFormat );
storage.save();
} else {
fn += ".ics";
FileStorage storage( cal, fn, new ICalFormat( ) );
storage.save();
}
delete cal;
mes = i18n("KO/Pi: Ready for beaming");
topLevelWidget()->setCaption(mes);
KApplication::convert2latin1( fn );
#ifndef DESKTOP_VERSION
Ir *ir = new Ir( this );
connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) );
ir->send( fn, description, "text/x-vCalendar" );
#endif
}
}
void CalendarView::beamDone( Ir *ir )
{
#ifndef DESKTOP_VERSION
delete ir;
#endif
topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") );
topLevelWidget()->raise();
}
void CalendarView::moveIncidence(Incidence * inc )
{
if ( !inc ) return;
// qDebug("showDatePickerForIncidence( ) ");
if ( mDateFrame->isVisible() )
mDateFrame->hide();
else {
int w =mDatePicker->sizeHint().width()+2*mDateFrame->lineWidth() ;
int h = mDatePicker->sizeHint().height()+2*mDateFrame->lineWidth() ;
int dw = QApplication::desktop()->width();
int dh = QApplication::desktop()->height();
mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
mDateFrame->show();
}
mDatePickerMode = 2;
mMoveIncidence = inc ;
QDate da;
if ( mMoveIncidence->type() == "Todo" ) {
Todo * to = (Todo *) mMoveIncidence;
if ( to->hasDueDate() )
da = to->dtDue().date();
else
da = QDate::currentDate();
} else {
da = mMoveIncidence->dtStart().date();
}
//PENDING set date for recurring incidence to date of recurrence
//mMoveIncidenceOldDate;
mDatePicker->setDate( da );
}
void CalendarView::showDatePicker( )
{
//qDebug("CalendarView::showDatePicker( ) ");
if ( mDateFrame->isVisible() )
mDateFrame->hide();
else {
int w =mDatePicker->sizeHint().width() ;
int h = mDatePicker->sizeHint().height() ;
int dw = QApplication::desktop()->width();
int dh = QApplication::desktop()->height();
mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
mDateFrame->show();
}
mDatePickerMode = 1;
mDatePicker->setDate( mNavigator->selectedDates().first() );
}
void CalendarView::showEventEditor()
{
#ifdef DESKTOP_VERSION
mEventEditor->show();
#else
- if ( mEventEditor->width() != QApplication::desktop()->width() ) {
- qDebug("CalendarView: recreate mEventEditor ");
+ if ( mEventEditor->width() < QApplication::desktop()->width() -60 || mEventEditor->width() > QApplication::desktop()->width() ) {
+ topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") );
+ qDebug("CalendarView: recreate mEventEditor %d %d", mEventEditor->width(), QApplication::desktop()->width() );
delete mEventEditor;
mEventEditor = mDialogManager->getEventEditor();
}
mEventEditor->showMaximized();
#endif
}
void CalendarView::showTodoEditor()
{
#ifdef DESKTOP_VERSION
mTodoEditor->show();
#else
- if ( mTodoEditor->width() != QApplication::desktop()->width() ) {
- qDebug("CalendarView: recreate mTodoEditor ");
+ if ( mTodoEditor->width() < QApplication::desktop()->width() -60|| mTodoEditor->width() > QApplication::desktop()->width() ) {
+ topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") );
+ qDebug("CalendarView: recreate mTodoEditor %d %d ", mTodoEditor->width() ,QApplication::desktop()->width() );
delete mTodoEditor;
mTodoEditor = mDialogManager->getTodoEditor();
}
mTodoEditor->showMaximized();
#endif
}
void CalendarView::cloneIncidence()
{
Incidence *incidence = currentSelection();
if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
if ( incidence ) {
cloneIncidence(incidence);
}
}
void CalendarView::moveIncidence()
{
Incidence *incidence = currentSelection();
if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
if ( incidence ) {
moveIncidence(incidence);
}
}
void CalendarView::beamIncidence()
{
Incidence *incidence = currentSelection();
if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
if ( incidence ) {
beamIncidence(incidence);
}
}
void CalendarView::toggleCancelIncidence()
{
Incidence *incidence = currentSelection();
if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
if ( incidence ) {
cancelIncidence(incidence);
}
}
void CalendarView::cancelIncidence(Incidence * inc )
{
inc->setCancelled( ! inc->cancelled() );
changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED );
updateView();
}
void CalendarView::cloneIncidence(Incidence * orgInc )
{
Incidence * newInc = orgInc->clone();
newInc->recreate();
if ( newInc->type() == "Todo" ) {
Todo* t = (Todo*) newInc;
- mTodoEditor->editTodo( t );
showTodoEditor();
+ mTodoEditor->editTodo( t );
if ( mTodoEditor->exec() ) {
mCalendar->addTodo( t );
updateView();
} else {
delete t;
}
}
else {
Event* e = (Event*) newInc;
- mEventEditor->editEvent( e );
showEventEditor();
+ mEventEditor->editEvent( e );
if ( mEventEditor->exec() ) {
mCalendar->addEvent( e );
updateView();
} else {
delete e;
}
}
}
void CalendarView::newEvent()
{
// TODO: Replace this code by a common eventDurationHint of KOBaseView.
KOAgendaView *aView = mViewManager->agendaView();
if (aView) {
if (aView->selectionStart().isValid()) {
if (aView->selectedIsAllDay()) {
newEvent(aView->selectionStart(),aView->selectionEnd(),true);
} else {
newEvent(aView->selectionStart(),aView->selectionEnd());
}
return;
}
}
QDate date = mNavigator->selectedDates().first();
QDateTime current = QDateTime::currentDateTime();
if ( date <= current.date() ) {
int hour = current.time().hour() +1;
newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ),
QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) );
} else
newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ),
QDateTime( date, QTime( KOPrefs::instance()->mStartTime +
KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) );
}
void CalendarView::newEvent(QDateTime fh)
{
newEvent(fh,
QDateTime(fh.addSecs(3600*KOPrefs::instance()->mDefaultDuration)));
}
void CalendarView::newEvent(QDate dt)
{
newEvent(QDateTime(dt, QTime(0,0,0)),
QDateTime(dt, QTime(0,0,0)), true);
}
void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay)
{
+ showEventEditor();
mEventEditor->newEvent(fromHint,toHint,allDay);
if ( mFilterView->filtersEnabled() ) {
CalFilter *filter = mFilterView->selectedFilter();
if (filter && filter->showCategories()) {
mEventEditor->setCategories(filter->categoryList().join(",") );
}
if ( filter )
mEventEditor->setSecrecy( filter->getSecrecy() );
}
- showEventEditor();
}
void CalendarView::todoAdded(Todo * t)
{
changeTodoDisplay ( t ,KOGlobals::EVENTADDED);
updateTodoViews();
}
void CalendarView::todoChanged(Todo * t)
{
emit todoModified( t, 4 );
// updateTodoViews();
}
void CalendarView::todoToBeDeleted(Todo *)
{
//qDebug("todoToBeDeleted(Todo *) ");
updateTodoViews();
}
void CalendarView::todoDeleted()
{
//qDebug(" todoDeleted()");
updateTodoViews();
}
void CalendarView::newTodo()
{
+ showTodoEditor();
mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),0,true);
if ( mFilterView->filtersEnabled() ) {
CalFilter *filter = mFilterView->selectedFilter();
if (filter && filter->showCategories()) {
mTodoEditor->setCategories(filter->categoryList().join(",") );
}
if ( filter )
mTodoEditor->setSecrecy( filter->getSecrecy() );
}
- showTodoEditor();
}
void CalendarView::newSubTodo()
{
Todo *todo = selectedTodo();
if ( todo ) newSubTodo( todo );
}
void CalendarView::newSubTodo(Todo *parentEvent)
{
- mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),parentEvent,true);
showTodoEditor();
+ mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),parentEvent,true);
}
void CalendarView::newFloatingEvent()
{
DateList tmpList = mNavigator->selectedDates();
QDate date = tmpList.first();
newEvent( QDateTime( date, QTime( 12, 0, 0 ) ),
QDateTime( date, QTime( 12, 0, 0 ) ), true );
}
void CalendarView::editEvent( Event *event )
{
if ( !event ) return;
if ( event->isReadOnly() ) {
showEvent( event );
return;
}
- mEventEditor->editEvent( event , mFlagEditDescription);
showEventEditor();
+ mEventEditor->editEvent( event , mFlagEditDescription);
}
void CalendarView::editJournal( Journal *jour )
{
if ( !jour ) return;
mDialogManager->hideSearchDialog();
mViewManager->showJournalView();
mNavigator->slotDaySelect( jour->dtStart().date() );
}
void CalendarView::editTodo( Todo *todo )
{
if ( !todo ) return;
if ( todo->isReadOnly() ) {
showTodo( todo );
return;
}
- mTodoEditor->editTodo( todo ,mFlagEditDescription);
showTodoEditor();
+ mTodoEditor->editTodo( todo ,mFlagEditDescription);
}
KOEventViewerDialog* CalendarView::getEventViewerDialog()
{
if ( !mEventViewerDialog ) {
mEventViewerDialog = new KOEventViewerDialog(this);
connect( mEventViewerDialog, SIGNAL( editIncidence( Incidence* )), this, SLOT(editIncidence( Incidence* ) ) );
connect( this, SIGNAL(configChanged()), mEventViewerDialog, SLOT(updateConfig()));
connect( mEventViewerDialog, SIGNAL(jumpToTime( const QDate &)),
dateNavigator(), SLOT( selectWeek( const QDate & ) ) );
connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ),
viewManager(), SLOT( showAgendaView( bool ) ) );
mEventViewerDialog->resize( 640, 480 );
}
return mEventViewerDialog;
}
void CalendarView::showEvent(Event *event)
{
getEventViewerDialog()->setEvent(event);
getEventViewerDialog()->showMe();
}
void CalendarView::showTodo(Todo *event)
{
getEventViewerDialog()->setTodo(event);
getEventViewerDialog()->showMe();
}
void CalendarView::showJournal( Journal *jour )
{
getEventViewerDialog()->setJournal(jour);
getEventViewerDialog()->showMe();
}
// void CalendarView::todoModified (Todo *event, int changed)
// {
// // if (mDialogList.find (event) != mDialogList.end ()) {
// // kdDebug() << "Todo modified and open" << endl;
// // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event];
// // temp->modified (changed);
// // }
// mViewManager->updateView();
// }
void CalendarView::appointment_show()
{
Event *anEvent = 0;
Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
if (mViewManager->currentView()->isEventView()) {
if ( incidence && incidence->type() == "Event" ) {
anEvent = static_cast<Event *>(incidence);
}
}
if (!anEvent) {
KNotifyClient::beep();
return;
}
showEvent(anEvent);
}
void CalendarView::appointment_edit()
{
Event *anEvent = 0;
Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
if (mViewManager->currentView()->isEventView()) {
if ( incidence && incidence->type() == "Event" ) {
anEvent = static_cast<Event *>(incidence);
}
}
if (!anEvent) {
KNotifyClient::beep();
return;
}
editEvent(anEvent);
}
void CalendarView::appointment_delete()
{
Event *anEvent = 0;
Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
if (mViewManager->currentView()->isEventView()) {
if ( incidence && incidence->type() == "Event" ) {
anEvent = static_cast<Event *>(incidence);
}
}
if (!anEvent) {
KNotifyClient::beep();
return;
}
deleteEvent(anEvent);
}
void CalendarView::todo_resub( Todo * parent, Todo * sub )
{
if (!sub) return;
if (!parent) return;
if ( sub->relatedTo() )
sub->relatedTo()->removeRelation(sub);
sub->setRelatedTo(parent);
sub->setRelatedToUid(parent->uid());
parent->addRelation(sub);
sub->updated();
parent->updated();
setModified(true);
updateView();
}
void CalendarView::todo_unsub(Todo *anTodo )
{
// Todo *anTodo = selectedTodo();
if (!anTodo) return;
if (!anTodo->relatedTo()) return;
anTodo->relatedTo()->removeRelation(anTodo);
anTodo->setRelatedTo(0);
anTodo->updated();
anTodo->setRelatedToUid("");
setModified(true);
updateView();
}
void CalendarView::deleteTodo(Todo *todo)
{
if (!todo) {
KNotifyClient::beep();
return;
}
if (KOPrefs::instance()->mConfirm) {
switch (msgItemDelete()) {
case KMessageBox::Continue: // OK
if (!todo->relations().isEmpty()) {
KMessageBox::sorry(this,i18n("Cannot delete To-Do\nwhich has children."),
i18n("Delete To-Do"));
} else {
checkExternalId( todo );
calendar()->deleteTodo(todo);
changeTodoDisplay( todo,KOGlobals::EVENTDELETED );
updateView();
}
break;
} // switch
} else {
if (!todo->relations().isEmpty()) {
KMessageBox::sorry(this,i18n("Cannot delete To-Do\nwhich has children."),
i18n("Delete To-Do"));
} else {
checkExternalId( todo );
mCalendar->deleteTodo(todo);
changeTodoDisplay( todo,KOGlobals::EVENTDELETED );
updateView();
}
}
emit updateSearchDialog();
}
void CalendarView::deleteJournal(Journal *jour)
{
if (!jour) {
KNotifyClient::beep();
return;
}
if (KOPrefs::instance()->mConfirm) {
switch (msgItemDelete()) {
case KMessageBox::Continue: // OK
calendar()->deleteJournal(jour);
updateView();
break;
} // switch
} else {
calendar()->deleteJournal(jour);;
updateView();
}
emit updateSearchDialog();
}
void CalendarView::deleteEvent(Event *anEvent)
{
if (!anEvent) {
KNotifyClient::beep();
return;
diff --git a/qtcompat/qinputdialog.cpp b/qtcompat/qinputdialog.cpp
index 770b281..64c581e 100644
--- a/qtcompat/qinputdialog.cpp
+++ b/qtcompat/qinputdialog.cpp
@@ -1,229 +1,231 @@
/****************************************************************************
** $Id$
**
** Implementation of QInputDialog class
**
** Created : 991212
**
** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
**
** This file is part of the dialogs module of the Qt GUI Toolkit.
**
** This file may be distributed under the terms of the Q Public License
** as defined by Trolltech AS of Norway and appearing in the file
** LICENSE.QPL included in the packaging of this file.
**
** 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.
**
** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
** licenses may use this file in accordance with the Qt Commercial License
** Agreement provided with the Software.
**
** 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/pricing.html or email sales@trolltech.com for
** information about Qt Commercial License Agreements.
** See http://www.trolltech.com/qpl/ for QPL licensing information.
** 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.
**
**********************************************************************/
+//Edited Lutz Rogowski 2004-12-13
+
#include "qinputdialog.h"
#include <qlayout.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qspinbox.h>
#include <qcombobox.h>
#include <qwidgetstack.h>
#include <qvalidator.h>
#include <qapplication.h>
class QInputDialogPrivate
{
public:
friend class QInputDialog;
QLineEdit *lineEdit;
QSpinBox *spinBox;
QComboBox *comboBox, *editComboBox;
QPushButton *ok;
QWidgetStack *stack;
QInputDialog::Type type;
};
/*!
\class QInputDialog qinputdialog.h
\brief A convenience dialog to get a simple input from the user
\ingroup dialogs
The QInputDialog is a simple dialog which can be used if you
need a simple input from the user. This can be text, a number or
an item from a list. Also a label has to be set to tell the user
what he/she should input.
In this Qt version only the 4 static convenience functions
getText(), getInteger(), getDouble() and getItem() of QInputDialog
are available.
Use it like this:
\code
bool ok = FALSE;
QString text = QInputDialog::getText( tr( "Make an input" ), tr( "Please enter your name" ), QString::null, &ok, this );
if ( ok && !text.isEmpty() )
;// user entered something and pressed ok
else
;// user entered nothing or pressed cancel
\endcode
There are more static convenience methods!
\sa getText(), getInteger(), getDouble(), getItem()
*/
/*!
\enum QInputDialog::Type
This enum type specifies the type of the dialog
(which kind of input can be done):
<ul>
<li>\c LineEdit - A QLineEdit is used for taking the input, so a textual or
(e.g. using a QValidator) a numerical input can be done. Using lineEdit()
the QLineEdit can be accessed.
<li>\c SpinBox - A QSpinBox is used for taking the input, so a decimal
input can be done. Using spinBox() the QSpinBox can be accessed.
<li>\c ComboBox - A read-only QComboBox is used for taking the input,
so one item of a list can be chosen. Using comboBox() the QComboBox
can be accessed.
<li>\c EditableComboBox - An editable QComboBox is used for taking the input,
so either one item of a list can be chosen or a text can be entered. Using
editableComboBox() the QComboBox can be accessed.
</ul>
*/
/*!
Constructs the dialog. \a label is the text which is shown to the user (it should mention
to the user what he/she should input), \a parent the parent widget of the dialog, \a name
the name of it and if you set \a modal to TRUE, the dialog pops up modally, else it pops
up modeless. With \a type you specify the type of the dialog.
\sa getText(), getInteger(), getDouble(), getItem()
*/
QInputDialog::QInputDialog( const QString &label, QWidget* parent, const char* name,
bool modal, Type type)
: QDialog( parent, name, modal )
{
if ( parent && parent->icon() &&!parent->icon()->isNull() )
setIcon( *parent->icon() );
else if ( qApp->mainWidget() && qApp->mainWidget()->icon() && !qApp->mainWidget()->icon()->isNull() )
QDialog::setIcon( *qApp->mainWidget()->icon() );
d = new QInputDialogPrivate;
d->lineEdit = 0;
d->spinBox = 0;
d->comboBox = 0;
QVBoxLayout *vbox = new QVBoxLayout( this, 6, 6 );
QLabel* l = new QLabel( label, this );
vbox->addWidget( l );
d->stack = new QWidgetStack( this );
vbox->addWidget( d->stack );
d->lineEdit = new QLineEdit( d->stack );
d->spinBox = new QSpinBox( d->stack );
d->comboBox = new QComboBox( FALSE, d->stack );
d->editComboBox = new QComboBox( TRUE, d->stack );
QHBoxLayout *hbox = new QHBoxLayout( 6 );
vbox->addLayout( hbox, AlignRight );
d->ok = new QPushButton( tr( "&OK" ), this );
d->ok->setDefault( TRUE );
QPushButton *cancel = new QPushButton( tr( "&Cancel" ), this );
QSize bs( d->ok->sizeHint() );
if ( cancel->sizeHint().width() > bs.width() )
bs.setWidth( cancel->sizeHint().width() );
d->ok->setFixedSize( bs );
cancel->setFixedSize( bs );
hbox->addWidget( new QWidget( this ) );
hbox->addWidget( d->ok );
hbox->addWidget( cancel );
connect( d->lineEdit, SIGNAL( returnPressed() ),
this, SLOT( tryAccept() ) );
connect( d->lineEdit, SIGNAL( textChanged( const QString & ) ),
this, SLOT( textChanged( const QString & ) ) );
connect( d->ok, SIGNAL( clicked() ), this, SLOT( accept() ) );
connect( cancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
//US ToDo make size dependent of targetplatform
//US resize( QMAX( sizeHint().width(), 400 ), sizeHint().height() );
resize( sizeHint().width(), sizeHint().height() );
setType( type );
}
/*!
Returns the line edit, which is used in the LineEdit mode
*/
QLineEdit *QInputDialog::lineEdit() const
{
return d->lineEdit;
}
/*!
Returns the spinbox, which is used in the SpinBox mode
*/
QSpinBox *QInputDialog::spinBox() const
{
return d->spinBox;
}
/*!
Returns the combobox, which is used in the ComboBox mode
*/
QComboBox *QInputDialog::comboBox() const
{
return d->comboBox;
}
/*!
Returns the combobox, which is used in the EditableComboBox mode
*/
QComboBox *QInputDialog::editableComboBox() const
{
return d->editComboBox;
}
/*!
Sets the input type of the dialog to \a t.
*/
void QInputDialog::setType( Type t )
{
switch ( t ) {
case LineEdit:
d->stack->raiseWidget( d->lineEdit );
d->lineEdit->setFocus();
break;
case SpinBox:
d->stack->raiseWidget( d->spinBox );
@@ -264,232 +266,237 @@ QInputDialog::~QInputDialog()
/*!
Static convenience function to get a textual input from the user. \a caption is the text
which is displayed in the title bar of the dialog. \a label is the text which
is shown to the user (it should mention to the user what he/she should input), \a text
the default text which will be initially set to the line edit, \a ok a pointer to
a bool which will be (if not 0!) set to TRUE if the user pressed ok or to FALSE if the
user pressed cancel, \a parent the parent widget of the dialog and \a name
the name of it. The dialogs pops up modally!
This method returns the text which has been entered in the line edit.
You will use this static method like this:
\code
bool ok = FALSE;
QString text = QInputDialog::getText( tr( "Please enter your name" ), QString::null, &ok, this );
if ( ok && !text.isEmpty() )
;// user entered something and pressed ok
else
;// user entered nothing or pressed cancel
\endcode
*/
QString QInputDialog::getText( const QString &caption, const QString &label, const QString &text,
bool *ok, QWidget *parent, const char *name )
{
return getText( caption, label, QLineEdit::Normal, text, ok, parent, name );
}
/*!
Like above, but accepts an a \a mode which the line edit will use to display text.
\sa getText()
*/
QString QInputDialog::getText( const QString &caption, const QString &label, QLineEdit::EchoMode mode,
const QString &text, bool *ok, QWidget *parent, const char *name )
{
QInputDialog *dlg = new QInputDialog( label, parent, name, TRUE, LineEdit );
dlg->setCaption( caption );
dlg->lineEdit()->setText( text );
dlg->lineEdit()->setEchoMode( mode );
if ( !text.isEmpty() )
dlg->lineEdit()->selectAll();
bool ok_ = FALSE;
QString result;
ok_ = dlg->exec() == QDialog::Accepted;
if ( ok )
*ok = ok_;
if ( ok_ )
result = dlg->lineEdit()->text();
delete dlg;
return result;
}
/*!
Static convenience function to get an integral input from the user. \a caption is the text
which is displayed in the title bar of the dialog. \a label is the text which
is shown to the user (it should mention to the user what he/she should input), \a num
the default number which will be initially set to the spinbox, \a from and \a to the
range in which the entered number has to be, \a step the step in which the number can
be increased/decreased by the spinbox, \a ok a pointer to
a bool which will be (if not 0!) set to TRUE if the user pressed ok or to FALSE if the
user pressed cancel, \a parent the parent widget of the dialog and \a name
the name of it. The dialogs pops up modally!
This method returns the number which has been entered by the user.
You will use this static method like this:
\code
bool ok = FALSE;
int res = QInputDialog::getInteger( tr( "Please enter a number" ), 22, 0, 1000, 2, &ok, this );
if ( ok )
;// user entered something and pressed ok
else
;// user pressed cancel
\endcode
*/
int QInputDialog::getInteger( const QString &caption, const QString &label, int num, int from, int to, int step,
bool *ok, QWidget *parent, const char *name )
{
QInputDialog *dlg = new QInputDialog( label, parent, name, TRUE, SpinBox );
dlg->setCaption( caption );
dlg->spinBox()->setRange( from, to );
dlg->spinBox()->setSteps( step, 0 );
dlg->spinBox()->setValue( num );
bool ok_ = FALSE;
int result;
ok_ = dlg->exec() == QDialog::Accepted;
if ( ok )
*ok = ok_;
result = dlg->spinBox()->value();
delete dlg;
return result;
}
/*!
Static convenience function to get a decimal input from the user. \a caption is the text
which is displayed in the title bar of the dialog. \a label is the text which
is shown to the user (it should mention to the user what he/she should input), \a num
the default decimal number which will be initially set to the line edit, \a from and \a to the
range in which the entered number has to be, \a decimals the number of decimal which
the number may have, \a ok a pointer to
a bool which will be (if not 0!) set to TRUE if the user pressed ok or to FALSE if the
user pressed cancel, \a parent the parent widget of the dialog and \a name
the name of it. The dialogs pops up modally!
This method returns the number which has been entered by the user.
You will use this static method like this:
\code
bool ok = FALSE;
double res = QInputDialog::getDouble( tr( "Please enter a decimal number" ), 33.7, 0, 1000, 2, &ok, this );
if ( ok )
;// user entered something and pressed ok
else
;// user pressed cancel
\endcode
*/
double QInputDialog::getDouble( const QString &caption, const QString &label, double num,
double from, double to, int decimals,
bool *ok, QWidget *parent, const char *name )
{
QInputDialog *dlg = new QInputDialog( label, parent, name, TRUE, LineEdit );
dlg->setCaption( caption );
dlg->lineEdit()->setValidator( new QDoubleValidator( from, to, decimals, dlg->lineEdit() ) );
dlg->lineEdit()->setText( QString::number( num, 'f', decimals ) );
dlg->lineEdit()->selectAll();
bool accepted = ( dlg->exec() == QDialog::Accepted );
if ( ok )
*ok = accepted;
double result = dlg->lineEdit()->text().toDouble();
delete dlg;
return result;
}
/*!
Static convenience function to let the user select an item from a string list. \a caption is the text
which is displayed in the title bar of the dialog. \a label is the text which
is shown to the user (it should mention to the user what he/she should input), \a list the
string list which is inserted into the combobox, \a current the number of the item which should
be initially the current item, \a editable specifies if the combobox should be editable (if it is TRUE)
or read-only (if \a editable is FALSE), \a ok a pointer to
a bool which will be (if not 0!) set to TRUE if the user pressed ok or to FALSE if the
user pressed cancel, \a parent the parent widget of the dialog and \a name
the name of it. The dialogs pops up modally!
This method returns the text of the current item, or if \a editable was TRUE, the current
text of the combobox.
You will use this static method like this:
\code
QStringList lst;
lst << "First" << "Second" << "Third" << "Fourth" << "Fifth";
bool ok = FALSE;
QString res = QInputDialog::getItem( tr( "Please select an item" ), lst, 1, TRUE, &ok, this );
if ( ok )
;// user selected an item and pressed ok
else
;// user pressed cancel
\endcode
*/
QString QInputDialog::getItem( const QString &caption, const QString &label, const QStringList &list,
int current, bool editable,
bool *ok, QWidget *parent, const char *name )
{
QInputDialog *dlg = new QInputDialog( label, parent, name, TRUE, editable ? EditableComboBox : ComboBox );
dlg->setCaption( caption );
if ( editable ) {
dlg->editableComboBox()->insertStringList( list );
dlg->editableComboBox()->setCurrentItem( current );
} else {
dlg->comboBox()->insertStringList( list );
dlg->comboBox()->setCurrentItem( current );
}
bool ok_ = FALSE;
QString result;
+ int fixWid = 320;
+ if ( QApplication::desktop()->width() <= 240 ) {
+ fixWid = 230;
+ }
+ dlg->setFixedWidth( fixWid);
ok_ = dlg->exec() == QDialog::Accepted;
if ( ok )
*ok = ok_;
if ( editable )
result = dlg->editableComboBox()->currentText();
else
result = dlg->comboBox()->currentText();
delete dlg;
return result;
}
/*!
\internal
*/
void QInputDialog::textChanged( const QString &s )
{
bool on;
if ( d->lineEdit->validator() ) {
QString str = d->lineEdit->text();
int index = d->lineEdit->cursorPosition();
on = ( d->lineEdit->validator()->validate(str, index) ==
QValidator::Acceptable );
} else {
on = !s.isEmpty();
}
d->ok->setEnabled( on );
}
/*!
\internal
*/
void QInputDialog::tryAccept()
{
if ( !d->lineEdit->text().isEmpty() )
accept();
}