summaryrefslogtreecommitdiff
authorar <ar>2004-02-07 23:52:31 (UTC)
committer ar <ar>2004-02-07 23:52:31 (UTC)
commit6582895befc98131430710191238a93b9dde161c (patch) (side-by-side diff)
treed050483742d0e102e08138bcdd8f170a9558b12d
parent3f261fa6eac46b8d0d4ac8b8bb95b385435004da (diff)
downloadopie-6582895befc98131430710191238a93b9dde161c.zip
opie-6582895befc98131430710191238a93b9dde161c.tar.gz
opie-6582895befc98131430710191238a93b9dde161c.tar.bz2
QPEApplication::showDialog() and QPEAPplication::execDialog() for better big screen handling
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/embeddedkonsole/konsole.cpp5
-rw-r--r--core/apps/textedit/textedit.cpp6
-rw-r--r--core/multimedia/opieplayer/playlistwidget.cpp3
-rw-r--r--core/pim/addressbook/abeditor.cpp3
-rw-r--r--core/pim/addressbook/addressbook.cpp8
-rw-r--r--core/pim/addressbook/contacteditor.cpp6
-rw-r--r--core/pim/datebook/datebook.cpp27
-rw-r--r--core/pim/datebook/dateentryimpl.cpp10
-rw-r--r--core/pim/datebook2/mainwindow.cpp9
-rw-r--r--core/pim/todo/mainwindow.cpp3
-rw-r--r--core/pim/todo/todoeditor.cpp9
-rw-r--r--core/settings/light-and-power/light.cpp4
12 files changed, 28 insertions, 65 deletions
diff --git a/core/apps/embeddedkonsole/konsole.cpp b/core/apps/embeddedkonsole/konsole.cpp
index a5adc03..ce8fb6b 100644
--- a/core/apps/embeddedkonsole/konsole.cpp
+++ b/core/apps/embeddedkonsole/konsole.cpp
@@ -1,97 +1,98 @@
/* ---------------------------------------------------------------------- */
/* */
/* [main.C] Konsole */
/* */
/* ---------------------------------------------------------------------- */
/* */
/* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */
/* */
/* This file is part of Konsole, an X terminal. */
/* */
/* The material contained in here more or less directly orginates from */
/* kvt, which is copyright (c) 1996 by Matthias Ettrich <ettrich@kde.org> */
/* */
/* ---------------------------------------------------------------------- */
/* */
/* Ported Konsole to Qt/Embedded */
/* */
/* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */
/* */
/* -------------------------------------------------------------------------- */
// enhancements added by L.J. Potter <ljp@llornkcor.com>
//#define QT_QWS_OPIE
#include "signal.h"
#include <qpe/resource.h>
#include <qdir.h>
#include <qevent.h>
#include <qdragobject.h>
#include <qobjectlist.h>
#include <qtoolbutton.h>
#include <qtoolbar.h>
#include <qpushbutton.h>
#include <qfontdialog.h>
#include <qglobal.h>
#include <qpainter.h>
#include <qmenubar.h>
#include <qmessagebox.h>
#include <qaction.h>
#include <qapplication.h>
#include <qfontmetrics.h>
#include <qcombobox.h>
#include <qevent.h>
#include <qtabwidget.h>
#include <qtabbar.h>
-#include <qpe/config.h>
#include <qstringlist.h>
#include <qpalette.h>
+#include <qpe/config.h>
+#include <qpe/qpeapplication.h>
#include <unistd.h>
#include <pwd.h>
#include <sys/types.h>
//#include <sys/wait.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include "konsole.h"
#include "keytrans.h"
#include "commandeditdialog.h"
#ifdef QT_QWS_OPIE
#include <opie/colorpopupmenu.h>
#endif
#include <qfontdatabase.h> // U.B.
#include <qstringlist.h> // U.B.
#include <qvaluelist.h> // U.B.
class EKNumTabBar : public QTabBar {
public:
void numberTabs()
{
// Yes, it really is this messy. QTabWidget needs functions
// that provide acces to tabs in a sequential way.
int m=INT_MIN;
for (int i=0; i<count(); i++) {
QTab* left=0;
QListIterator<QTab> it(*tabList());
int x=INT_MAX;
for( QTab* t; (t=it.current()); ++it ) {
int tx = t->rect().x();
if ( tx<x && tx>m ) {
x = tx;
left = t;
}
}
if ( left ) {
left->setText(QString::number(i+1));
m = left->rect().x();
}
}
}
};
class EKNumTabWidget : public QTabWidget {
@@ -1031,97 +1032,97 @@ i=-24;j=-25;k=-26;
void Konsole::editCommandListMenuSelected(int iD)
{
// QString temp;
// qDebug( temp.sprintf("edit command list %d",iD));
TEWidget* te = getTe();
Config cfg("Konsole");
cfg.setGroup("Menubar");
if( iD == -3) {
if(!secondToolBar->isHidden()) {
secondToolBar->hide();
configMenu->changeItem( iD,tr( "Show Command List" ));
cfg.writeEntry("Hidden","TRUE");
configMenu->setItemEnabled(-23 ,FALSE);
} else {
secondToolBar->show();
configMenu->changeItem( iD,tr( "Hide Command List" ));
cfg.writeEntry("Hidden","FALSE");
configMenu->setItemEnabled(-23 ,TRUE);
if(cfg.readEntry("EditEnabled","FALSE")=="TRUE") {
configMenu->setItemChecked(-23,TRUE);
commonCombo->setEditable( TRUE );
} else {
configMenu->setItemChecked(-23,FALSE);
commonCombo->setEditable( FALSE );
}
}
}
if( iD == -23) {
cfg.setGroup("Commands");
// qDebug("enableCommandEdit");
if( !configMenu->isItemChecked(iD) ) {
commonCombo->setEditable( TRUE );
configMenu->setItemChecked(iD,TRUE);
commonCombo->setCurrentItem(0);
cfg.writeEntry("EditEnabled","TRUE");
} else {
commonCombo->setEditable( FALSE );
configMenu->setItemChecked(iD,FALSE);
cfg.writeEntry("EditEnabled","FALSE");
commonCombo->setFocusPolicy(QWidget::NoFocus);
te->setFocus();
}
}
if(iD == -24) {
// "edit commands"
CommandEditDialog *m = new CommandEditDialog(this);
connect(m,SIGNAL(commandsEdited()),this,SLOT(initCommandList()));
- m->showMaximized();
+ QPEApplication::showDialog( m );
}
}
// $QPEDIR/bin/qcop QPE/Application/embeddedkonsole 'setDocument(QString)' 'ssh -V'
void Konsole::setDocument( const QString &cmd) {
newSession();
TEWidget* te = getTe();
if(cmd.find("-e", 0, TRUE) != -1) {
QString cmd2;
cmd2=cmd.right(cmd.length()-3)+" &";
system(cmd2.latin1());
if(startUp <= 1 && nsessions < 2) {
doneSession(getTe()->currentSession, 0);
exit(0);
} else
doneSession(getTe()->currentSession, 0);
} else {
if (te != 0) {
te->emitText(cmd+"\r");
}
}
startUp++;
}
void Konsole::parseCommandLine() {
QString cmd;
// newSession();
for (int i=1;i< qApp->argc();i++) {
if( QString(qApp->argv()[i]) == "-e") {
i++;
for ( int j=i;j< qApp->argc();j++) {
cmd+=QString(qApp->argv()[j])+" ";
}
cmd.stripWhiteSpace();
system(cmd.latin1());
exit(0);//close();
} // end -e switch
}
startUp++;
}
void Konsole::changeForegroundColor(const QColor &color) {
Config cfg("Konsole");
cfg.setGroup("Colors");
int r, g, b;
color.rgb(&r,&g,&b);
foreground.setRgb(r,g,b);
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp
index be18140..1299fe3 100644
--- a/core/apps/textedit/textedit.cpp
+++ b/core/apps/textedit/textedit.cpp
@@ -897,172 +897,170 @@ bool TextEdit::saveAs() {
text << "text/*";
map.insert(tr("Text"), text );
text << "*";
map.insert(tr("All"), text );
QFileInfo cuFi( currentFileName);
QString filee = cuFi.fileName();
QString dire = cuFi.dirPath();
if(dire==".")
dire = QPEApplication::documentDir();
QString str;
if( !featureAutoSave)
{
str = OFileDialog::getSaveFileName( 2,
dire,
filee, map);
}
else
str=currentFileName;
if(!str.isEmpty()) {
QString fileNm=str;
qDebug("saving filename "+fileNm);
QFileInfo fi(fileNm);
currentFileName=fi.fileName();
if(doc)
// QString file = doc->file();
// doc->removeFiles();
delete doc;
DocLnk nf;
nf.setType("text/plain");
nf.setFile( fileNm);
doc = new DocLnk(nf);
// editor->setText(rt);
qDebug("Saving file as "+currentFileName);
doc->setName( currentFileName);
updateCaption( currentFileName);
FileManager fm;
if ( !fm.saveFile( *doc, rt ) ) {
return false;
}
if( filePerms ) {
filePermissions *filePerm;
filePerm = new filePermissions(this,
tr("Permissions"),true,
0,(const QString &)fileNm);
- filePerm->showMaximized();
- filePerm->exec();
+ QPEApplication::execDialog( filePerm );
if( filePerm)
delete filePerm;
}
// }
editor->setEdited( false);
edited1 = false;
edited = false;
if(caption().left(1)=="*")
setCaption(caption().right(caption().length()-1));
return true;
}
qDebug("returning false");
return false;
} //end saveAs
void TextEdit::clear() {
delete doc;
doc = 0;
editor->clear();
}
void TextEdit::updateCaption( const QString &name ) {
if ( name.isEmpty() )
setCaption( tr("Text Editor") );
else {
QString s = name;
if ( s.isNull() )
s = doc->name();
if ( s.isEmpty() ) {
s = tr( "Unnamed" );
currentFileName=s;
}
// if(s.left(1) == "/")
// s = s.right(s.length()-1);
setCaption( tr("%1 - Text Editor").arg( s ) );
}
}
void TextEdit::setDocument(const QString& fileref) {
if(fileref != "Unnamed") {
currentFileName=fileref;
qDebug("setDocument");
QFileInfo fi(currentFileName);
qDebug("basename:"+fi.baseName()+": current filenmame "+currentFileName);
if( (fi.baseName().left(1)).isEmpty() ) {
openDotFile(currentFileName);
} else {
qDebug("setDoc open");
bFromDocView = true;
openFile(fileref);
editor->setEdited(true);
edited1=false;
edited=true;
// fromSetDocument=false;
// doSearchBar();
}
}
updateCaption( currentFileName);
}
void TextEdit::changeFont() {
QDialog *d = new QDialog ( this, "FontDialog", true );
d-> setCaption ( tr( "Choose font" ));
QBoxLayout *lay = new QVBoxLayout ( d );
OFontSelector *ofs = new OFontSelector ( true, d );
lay-> addWidget ( ofs );
ofs-> setSelectedFont ( editor-> font ( ));
- d-> showMaximized ( );
- if ( d-> exec ( ) == QDialog::Accepted )
+ if ( QPEApplication::execDialog( d ) == QDialog::Accepted )
editor-> setFont ( ofs-> selectedFont ( ));
delete d;
}
void TextEdit::editDelete() {
switch ( QMessageBox::warning(this,tr("Text Editor"),
tr("Do you really want<BR>to <B>delete</B> "
"the current file\nfrom the disk?<BR>This is "
"<B>irreversable!</B>"),
tr("Yes"),tr("No"),0,0,1) ) {
case 0:
if(doc) {
doc->removeFiles();
clear();
setCaption( tr("Text Editor") );
}
break;
case 1:
// exit
break;
};
}
void TextEdit::changeStartConfig( bool b ) {
startWithNew=b;
Config cfg("TextEdit");
cfg.setGroup("View");
cfg.writeEntry("startNew",b);
update();
}
void TextEdit::editorChanged() {
// qDebug("editor changed");
if( /*editor->edited() &&*/ /*edited && */!edited1) {
setCaption( "*"+caption());
edited1=true;
}
edited=true;
}
void TextEdit::receive(const QCString&msg, const QByteArray &) {
qDebug("QCop "+msg);
if ( msg == "setDocument(QString)" ) {
qDebug("bugger all");
}
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp
index 5fb605b..82fd1e1 100644
--- a/core/multimedia/opieplayer/playlistwidget.cpp
+++ b/core/multimedia/opieplayer/playlistwidget.cpp
@@ -904,98 +904,97 @@ void PlayListWidget::viewPressed( int mouse, QListViewItem *, const QPoint&, int
m.exec( QCursor::pos() );
}
break;
};
}
void PlayListWidget::playSelected()
{
btnPlay( true);
// d->selectedFiles->unSelect();
}
void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *, const QPoint&, int)
{
switch (mouse) {
case 1:
break;
case 2:{
QPopupMenu m;
m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() ));
m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() ));
// m.insertSeparator();
// m.insertItem( tr( "Properties" ), this, SLOT( listDelete() ));
m.exec( QCursor::pos() );
}
break;
};
}
void PlayListWidget::listDelete() {
Config cfg( "OpiePlayer" );
cfg.setGroup("PlayList");
currentPlayList = cfg.readEntry("CurrentPlaylist","");
QString file;
// int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 );
switch ( tabWidget->currentPageIndex()) {
case 0:
break;
case 1:
{
file = audioView->currentItem()->text(0);
QListIterator<DocLnk> Pdit( files.children() );
for ( ; Pdit.current(); ++Pdit ) {
if( Pdit.current()->name() == file) {
LnkProperties prop( Pdit.current() );
- prop.showMaximized();
- prop.exec();
+ QPEApplication::execDialog( &prop );
}
}
populateAudioView();
}
break;
case 2:
{
// file = videoView->selectedItem()->text(0);
// for ( int i = 0; i < noOfFiles; i++ ) {
// QString entryName;
// entryName.sprintf( "File%i", i + 1 );
// QString linkFile = cfg.readEntry( entryName );
// AppLnk lnk( AppLnk(linkFile));
// if( lnk.name() == file ) {
// LnkProperties prop( &lnk);
// // connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *)));
// prop.showMaximized();
// prop.exec();
// }
// }
}
break;
};
}
void PlayListWidget::scanForAudio() {
// qDebug("scan for audio");
files.detachChildren();
QListIterator<DocLnk> sdit( files.children() );
for ( ; sdit.current(); ++sdit ) {
delete sdit.current();
}
Global::findDocuments( &files, audioMimes);
audioScan = true;
}
void PlayListWidget::scanForVideo() {
// qDebug("scan for video");
vFiles.detachChildren();
QListIterator<DocLnk> sdit( vFiles.children() );
for ( ; sdit.current(); ++sdit ) {
delete sdit.current();
}
Global::findDocuments(&vFiles, "video/*");
videoScan = true;
}
void PlayListWidget::populateAudioView() {
diff --git a/core/pim/addressbook/abeditor.cpp b/core/pim/addressbook/abeditor.cpp
index 91e8722..75e7ede 100644
--- a/core/pim/addressbook/abeditor.cpp
+++ b/core/pim/addressbook/abeditor.cpp
@@ -485,98 +485,97 @@ void AbEditor::saveEntry()
case Qtopia::BusinessMobile:
ent.setBusinessMobile( it.current()->text() );
break;
case Qtopia::BusinessPager:
ent.setBusinessPager( it.current()->text() );
break;
case Qtopia::Profession:
ent.setProfession( it.current()->text() );
break;
case Qtopia::Assistant:
ent.setAssistant( it.current()->text() );
break;
case Qtopia::Manager:
ent.setManager( it.current()->text() );
break;
// personal
case Qtopia::Spouse:
ent.setSpouse( it.current()->text() );
break;
case Qtopia::Children:
ent.setChildren( it.current()->text() );
break;
case Qtopia::Birthday:
ent.setBirthday( it.current()->text() );
break;
case Qtopia::Anniversary:
ent.setAnniversary( it.current()->text() );
break;
case Qtopia::Nickname:
ent.setNickname( it.current()->text() );
break;
default:
break;
}
}
int gender = genderCombo->currentItem();
ent.setGender( QString::number( gender ) );
QString str = txtNote->text();
if ( !str.isNull() )
ent.setNotes( str );
}
void AbEditor::slotNote()
{
- dlgNote->showMaximized();
- if ( !dlgNote->exec() ) {
+ if ( ! QPEApplication::execDialog( &dlgNote ) ) {
// reset the note...
txtNote->setText( ent.notes() );
}
}
void AbEditor::setNameFocus()
{
firstEdit->setFocus();
}
void parseEmailFrom( const QString &txt, QString &strDefaultEmail,
QString &strAll )
{
int where,
start;
if ( txt.isEmpty() )
return;
// find the first
where = txt.find( ',' );
if ( where < 0 ) {
strDefaultEmail = txt;
strAll = txt;
} else {
strDefaultEmail = txt.left( where ).stripWhiteSpace();
strAll = strDefaultEmail;
while ( where > -1 ) {
strAll.append(" ");
start = where;
where = txt.find( ',', where + 1 );
if ( where > - 1 )
strAll.append( txt.mid(start + 1, where - start - 1).stripWhiteSpace() );
else // grab until the end...
strAll.append( txt.right(txt.length() - start - 1).stripWhiteSpace() );
}
}
}
void parseEmailTo( const QString &strDefaultEmail,
const QString &strOtherEmail, QString &strBack )
{
// create a comma dilimeted set of emails...
// use the power of short circuiting...
bool foundDefault = false;
QString strTmp;
int start = 0;
int where;
// start at the beginng.
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp
index 00cd2a6..1c7ddd4 100644
--- a/core/pim/addressbook/addressbook.cpp
+++ b/core/pim/addressbook/addressbook.cpp
@@ -237,98 +237,97 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
// Create Views
listContainer = new QWidget( this );
QVBoxLayout *vb = new QVBoxLayout( listContainer );
m_abView = new AbView( listContainer, m_config.orderList() );
vb->addWidget( m_abView );
// abList->setHScrollBarMode( QScrollView::AlwaysOff );
connect( m_abView, SIGNAL( signalViewSwitched ( int ) ),
this, SLOT( slotViewSwitched( int ) ) );
QObject::connect( m_abView, SIGNAL(signalNotFound()), this, SLOT(slotNotFound()) );
// m_abView->load(); // Already done by c'tor .
// Letter Picker
pLabel = new LetterPicker( listContainer );
connect(pLabel, SIGNAL(letterClicked(char)), this, SLOT(slotSetLetter(char)));
connect(m_abView, SIGNAL( signalClearLetterPicker() ), pLabel, SLOT( clear() ) );
vb->addWidget( pLabel );
// All Categories into view-menu..
populateCategories();
// Fontsize
defaultFont = new QFont( m_abView->font() );
slotSetFont(m_config.fontSize());
m_curFontSize = m_config.fontSize();
setCentralWidget(listContainer);
// qDebug("adressbook contrsuction: t=%d", t.elapsed() );
connect( qApp, SIGNAL( flush() ), this, SLOT( flush() ) );
connect( qApp, SIGNAL( reload() ), this, SLOT( reload() ) );
connect( qApp, SIGNAL( appMessage(const QCString &, const QByteArray &) ),
this, SLOT( appMessage(const QCString &, const QByteArray &) ) );
isLoading = false;
}
void AddressbookWindow::slotConfig()
{
ConfigDlg* dlg = new ConfigDlg( this, "Config" );
dlg -> setConfig( m_config );
- dlg -> showMaximized();
- if ( dlg -> exec() ) {
+ if ( QPEApplication::execDialog( dlg ) ) {
qWarning ("Config Dialog accepted!");
m_config = dlg -> getConfig();
if ( m_curFontSize != m_config.fontSize() ){
qWarning("Font was changed!");
m_curFontSize = m_config.fontSize();
emit slotSetFont( m_curFontSize );
}
m_abView -> setListOrder( m_config.orderList() );
}
delete dlg;
}
void AddressbookWindow::slotSetFont( int size )
{
qWarning("void AddressbookWindow::slotSetFont( %d )", size);
if (size > 2 || size < 0)
size = 1;
m_config.setFontSize( size );
QFont *currentFont;
switch (size) {
case 0:
m_abView->setFont( QFont( defaultFont->family(), defaultFont->pointSize() - 2 ) );
currentFont = new QFont (m_abView->font());
// abList->resizeRows(currentFont->pixelSize() + 7); :SX
// abList->resizeRows();
break;
case 1:
m_abView->setFont( *defaultFont );
currentFont = new QFont (m_abView->font());
// // abList->resizeRows(currentFont->pixelSize() + 7);
// abList->resizeRows();
break;
case 2:
m_abView->setFont( QFont( defaultFont->family(), defaultFont->pointSize() + 2 ) );
currentFont = new QFont (m_abView->font());
// //abList->resizeRows(currentFont->pixelSize() + 7);
// abList->resizeRows();
break;
}
}
@@ -705,102 +704,99 @@ void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data)
if ( actionPersonal->isOn() ){
actionPersonal->setOn( false );
slotPersonalView();
}
// Reset category and show as card..
m_abView -> setShowByCategory( QString::null );
m_abView -> setCurrentUid( uid );
slotViewSwitched ( AbView::CardView );
needShow = true;
} else if ( msg == "edit(int)" ) {
QDataStream stream(data,IO_ReadOnly);
int uid;
stream >> uid;
// Deactivate Personal View..
if ( actionPersonal->isOn() ){
actionPersonal->setOn( false );
slotPersonalView();
}
// Reset category and edit..
m_abView -> setShowByCategory( QString::null );
m_abView -> setCurrentUid( uid );
slotViewEdit();
}
if (needShow)
QPEApplication::setKeepRunning();
}
void AddressbookWindow::editEntry( EntryMode entryMode )
{
OContact entry;
if ( !abEditor ) {
abEditor = new ContactEditor( entry, this, "editor" );
}
if ( entryMode == EditEntry )
abEditor->setEntry( m_abView -> currentEntry() );
else if ( entryMode == NewEntry )
abEditor->setEntry( entry );
// other things may change the caption.
abEditor->setCaption( tr("Edit Address") );
-#if defined(Q_WS_QWS) || defined(_WS_QWS_)
- abEditor->showMaximized();
-#endif
// fix the foxus...
abEditor->setNameFocus();
- if ( abEditor->exec() ) {
+ if ( QPEApplication::execDialog( abEditor ) ) {
setFocus();
if ( entryMode == NewEntry ) {
OContact insertEntry = abEditor->entry();
insertEntry.assignUid();
m_abView -> addEntry( insertEntry );
m_abView -> setCurrentUid( insertEntry.uid() );
} else {
OContact replEntry = abEditor->entry();
if ( !replEntry.isValidUid() )
replEntry.assignUid();
m_abView -> replaceEntry( replEntry );
}
}
// populateCategories();
}
void AddressbookWindow::editPersonal()
{
OContact entry;
// Switch to personal view if not selected
// but take care of the menu, too
if ( ! actionPersonal->isOn() ){
qWarning("*** ++++");
actionPersonal->setOn( true );
slotPersonalView();
}
if ( !abEditor ) {
abEditor = new ContactEditor( entry, this, "editor" );
}
abEditor->setCaption(tr("Edit My Personal Details"));
abEditor->setPersonalView( true );
editEntry( EditEntry );
abEditor->setPersonalView( false );
}
void AddressbookWindow::slotPersonalView()
{
qWarning("slotPersonalView()");
if (!actionPersonal->isOn()) {
// we just turned it off
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp
index 8fbd065..7932781 100644
--- a/core/pim/addressbook/contacteditor.cpp
+++ b/core/pim/addressbook/contacteditor.cpp
@@ -1038,113 +1038,111 @@ void ContactEditor::slotFullNameChange( const QString &textChanged ) {
qWarning( "ContactEditor::slotFullNameChange( %s )", textChanged.latin1() );
int index = cmbFileAs->currentItem();
cmbFileAs->clear();
cmbFileAs->insertItem( parseName( textChanged, NAME_LF ) );
cmbFileAs->insertItem( parseName( textChanged, NAME_LFM ) );
cmbFileAs->insertItem( parseName( textChanged, NAME_FL ) );
cmbFileAs->insertItem( parseName( textChanged, NAME_FML ) );
if ( ! txtSuffix->text().isEmpty() )
cmbFileAs->insertItem( parseName( textChanged, NAME_FML ) + " " + txtSuffix->text() );
cmbFileAs->setCurrentItem( index );
}
void ContactEditor::slotSuffixChange( const QString& ) {
// Just want to update the FileAs combo if the suffix was changed..
slotFullNameChange( txtFullName->text() );
}
void ContactEditor::slotOrganizationChange( const QString &textChanged ){
qWarning( "ContactEditor::slotOrganizationChange( %s )", textChanged.latin1() );
// Special handling for storing Companies:
// If no Fullname is given, we store the Company-Name as lastname
// to handle it like a person..
if ( txtFullName->text() == txtOrganization->text().left( txtFullName->text().length() ) )
txtFullName->setText( textChanged );
}
void ContactEditor::accept() {
if ( isEmpty() ) {
cleanupFields();
reject();
} else {
saveEntry();
cleanupFields();
QDialog::accept();
}
}
void ContactEditor::slotNote() {
- dlgNote->showMaximized();
- if ( !dlgNote->exec() ) {
+ if ( ! QPEApplication::execDialog( dlgNote ) ) {
txtNote->setText( ent.notes() );
}
}
void ContactEditor::slotName() {
QString tmpName;
txtFirstName->setText( parseName(txtFullName->text(), NAME_F) );
txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) );
txtLastName->setText( parseName(txtFullName->text(), NAME_L) );
// txtSuffix->setText( parseName(txtFullName->text(), NAME_S) );
- dlgName->showMaximized();
- if ( dlgName->exec() ) {
+ if ( QPEApplication::execDialog( dlgName ) ) {
if ( txtLastName->text().contains( ' ', TRUE ) )
tmpName = txtLastName->text() + ", " + txtFirstName->text() + " " + txtMiddleName->text();
else
tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text();
txtFullName->setText( tmpName.simplifyWhiteSpace() );
slotFullNameChange( txtFullName->text() );
}
}
void ContactEditor::setNameFocus() {
txtFullName->setFocus();
}
bool ContactEditor::isEmpty() {
// Test and see if the record should be saved.
// More strict than the original qtopia, needs name or fileas to save
QString t = txtFullName->text();
if ( !t.isEmpty() && containsAlphaNum( t ) )
return false;
t = cmbFileAs->currentText();
if ( !t.isEmpty() && containsAlphaNum( t ) )
return false;
return true;
}
QString ContactEditor::parseName( const QString fullName, int type ) {
QString simplifiedName( fullName.simplifyWhiteSpace() );
QString strFirstName;
QString strMiddleName;
QString strLastName;
QString strTitle;
int commapos;
bool haveLastName = false;
qWarning("Fullname: %s", simplifiedName.latin1());
commapos = simplifiedName.find( ',', 0, TRUE);
if ( commapos >= 0 ) {
qWarning(" Commapos: %d", commapos );
diff --git a/core/pim/datebook/datebook.cpp b/core/pim/datebook/datebook.cpp
index 44f1515..706cc08 100644
--- a/core/pim/datebook/datebook.cpp
+++ b/core/pim/datebook/datebook.cpp
@@ -220,102 +220,97 @@ void DateBook::receive( const QCString &msg, const QByteArray &data )
// update active view!
if ( dayAction->isOn() )
viewDay();
else if ( weekAction->isOn() )
viewWeek();
else if ( monthAction->isOn() )
viewMonth();
}
else if (msg == "editEvent(int)") {
int uid;
stream >> uid;
Event e=db->eventByUID(uid);
editEvent(e);
}else if (msg == "viewDefault(QDate)"){
QDate day;
stream >> day;
viewDefault(day);
}
}
DateBook::~DateBook()
{
}
void DateBook::slotSettings()
{
DateBookSettings frmSettings( ampm, this );
frmSettings.setStartTime( startTime );
frmSettings.setAlarmPreset( aPreset, presetTime );
frmSettings.setJumpToCurTime( bJumpToCurTime );
frmSettings.setRowStyle( rowStyle );
frmSettings.comboDefaultView->setCurrentItem(defaultView-1);
frmSettings.comboWeekListView->setCurrentItem(weeklistviewconfig);
bool found=false;
for (int i=0; i<(frmSettings.comboLocation->count()); i++) {
if ( frmSettings.comboLocation->text(i) == defaultLocation ) {
frmSettings.comboLocation->setCurrentItem(i);
found=true;
break;
}
}
if(!found) {
frmSettings.comboLocation->insertItem(defaultLocation);
frmSettings.comboLocation->setCurrentItem(frmSettings.comboLocation->count()-1);
}
frmSettings.comboCategory->setCategories(defaultCategories,"Calendar", tr("Calendar"));
-#if defined (Q_WS_QWS) || defined(_WS_QWS_)
- frmSettings.showMaximized();
-#endif
-
- if ( frmSettings.exec() ) {
-
+ if ( QPEApplication::execDialog( &frmSettings ) ) {
aPreset = frmSettings.alarmPreset();
presetTime = frmSettings.presetTime();
startTime = frmSettings.startTime();
bJumpToCurTime = frmSettings.jumpToCurTime();
rowStyle = frmSettings.rowStyle();
defaultView=frmSettings.comboDefaultView->currentItem()+1;
weeklistviewconfig=frmSettings.comboWeekListView->currentItem();
defaultLocation=frmSettings.comboLocation->currentText();
defaultCategories=frmSettings.comboCategory->currentCategories();
if ( dayView ) {
dayView->setStartViewTime( startTime );
dayView->setJumpToCurTime( bJumpToCurTime );
dayView->setRowStyle( rowStyle );
}
if ( weekView ) {
weekView->setStartViewTime( startTime );
}
saveSettings();
// make the change obvious
if ( views->visibleWidget() ) {
if ( views->visibleWidget() == dayView )
dayView->redraw();
else if ( views->visibleWidget() == weekView )
weekView->redraw();
else if ( views->visibleWidget() == weekLstView )
weekLstView->redraw();
}
}
}
void DateBook::fileNew()
{
slotNewEventFromKey("");
}
QString DateBook::checkEvent(const Event &e)
{
/* check if overlaps with itself */
bool checkFailed = FALSE;
/* check the next 12 repeats. should catch most problems */
QDate current_date = e.start().date();
Event previous = e;
for(int i = 0; i < 12; i++)
{
QDateTime next;
@@ -392,149 +387,143 @@ void DateBook::viewDay() {
void DateBook::viewWeek() {
view(WEEK,currentDate());
}
void DateBook::viewWeekLst() {
view(WEEKLST,currentDate());
}
void DateBook::viewMonth() {
view(MONTH,currentDate());
}
void DateBook::insertEvent( const Event &e )
{
Event dupEvent=e;
if(!dupEvent.isValidUid() ) // tkcRom seems to be different
dupEvent.assignUid();
dupEvent.setLocation(defaultLocation);
dupEvent.setCategories(defaultCategories);
db->addEvent(dupEvent);
emit newEvent();
}
void DateBook::duplicateEvent( const Event &e )
{
qWarning("Hmmm...");
// Alot of code duplication, as this is almost like editEvent();
if (syncing) {
QMessageBox::warning( this, tr("Calendar"), tr( "Can not edit data, currently syncing") );
return;
}
Event dupevent(e); // Make a duplicate.
// workaround added for text input.
QDialog editDlg( this, 0, TRUE );
DateEntry *entry;
editDlg.setCaption( tr("Duplicate Event") );
QVBoxLayout *vb = new QVBoxLayout( &editDlg );
QScrollView *sv = new QScrollView( &editDlg, "scrollview" );
sv->setResizePolicy( QScrollView::AutoOneFit );
// KLUDGE!!!
sv->setHScrollBarMode( QScrollView::AlwaysOff );
vb->addWidget( sv );
entry = new DateEntry( onMonday, dupevent, ampm, &editDlg, "editor" );
entry->timezone->setEnabled( FALSE );
sv->addChild( entry );
-#if defined(Q_WS_QWS) || defined(_WS_QWS_)
- editDlg.showMaximized();
-#endif
- while (editDlg.exec() ) {
+ while ( QPEApplication::execDialog( &editDlg ) ) {
Event newEv = entry->event();
QString error = checkEvent(newEv);
if (!error.isNull()) {
if (QMessageBox::warning(this, tr("error box"), error, tr("Fix it"), tr("Continue"), 0, 0, 1) == 0)
continue;
}
/*
* The problem:
* DateBookDB does remove repeating events not by uid but by the time
* the recurrence was created
* so we need to update that time as well
*/
Event::RepeatPattern rp = newEv.repeatPattern();
rp.createTime = ::time( NULL );
newEv.setRepeat( TRUE, rp ); // has repeat and repeatPattern...
if( newEv.uid() == e.uid() || !newEv.isValidUid() )
newEv.assignUid();
db->addEvent(newEv);
emit newEvent();
break;
}
}
void DateBook::editEvent( const Event &e )
{
if (syncing) {
QMessageBox::warning( this, tr("Calendar"), tr( "Can not edit data, currently syncing") );
return;
}
// workaround added for text input.
QDialog editDlg( this, 0, TRUE );
DateEntry *entry;
editDlg.setCaption( tr("Edit Event") );
QVBoxLayout *vb = new QVBoxLayout( &editDlg );
QScrollView *sv = new QScrollView( &editDlg, "scrollview" );
sv->setResizePolicy( QScrollView::AutoOneFit );
// KLUDGE!!!
sv->setHScrollBarMode( QScrollView::AlwaysOff );
vb->addWidget( sv );
entry = new DateEntry( onMonday, e, ampm, &editDlg, "editor" );
entry->timezone->setEnabled( FALSE );
sv->addChild( entry );
-#if defined(Q_WS_QWS) || defined(_WS_QWS_)
- editDlg.showMaximized();
-#endif
- while (editDlg.exec() ) {
+ while ( QPEApplication::execDialog( &editDlg ) ) {
Event newEv = entry->event();
if(newEv.description().isEmpty() && newEv.notes().isEmpty() )
break;
newEv.setUid(e.uid()); // FIXME: Hack not to clear uid
QString error = checkEvent(newEv);
if (!error.isNull()) {
if (QMessageBox::warning(this, tr("error box"), error, tr("Fix it"), tr("Continue"), 0, 0, 1) == 0) continue;
}
db->editEvent(e, newEv);
emit newEvent();
break;
}
}
void DateBook::removeEvent( const Event &e )
{
if (syncing) {
QMessageBox::warning( this, tr("Calendar"), tr( "Can not edit data, currently syncing") );
return;
}
QString strName = e.description();
if ( !QPEMessageBox::confirmDelete( this, tr( "Calendar" ),strName ) )
return;
db->removeEvent( e );
if ( views->visibleWidget() == dayView && dayView )
dayView->redraw();
}
void DateBook::addEvent( const Event &e )
{
QDate d = e.start().date();
initDay();
dayView->setDate( d );
}
void DateBook::showDay( int year, int month, int day )
{
QDate d(year, month, day);
view(DAY,d);
}
void DateBook::initDay()
{
if ( !dayView ) {
dayView = new DateBookDay( ampm, onMonday, db, views, "day view" );
@@ -662,100 +651,97 @@ void DateBook::appMessage(const QCString& msg, const QByteArray& data)
// check to make it's okay to continue,
// this is the case that the time was set ahead, and
// we are forced given a stale alarm...
QDateTime current = QDateTime::currentDateTime();
if ( current.time().hour() != when.time().hour() && current.time().minute() != when.time().minute() )
return;
QValueList<EffectiveEvent> list = db->getEffectiveEvents(when.addSecs(warn*60));
if ( list.count() > 0 ) {
QString msg;
bool bSound = FALSE;
int stopTimer = 0;
bool found = FALSE;
for ( QValueList<EffectiveEvent>::ConstIterator it=list.begin(); it!=list.end(); ++it ) {
if ( (*it).event().hasAlarm() ) {
found = TRUE;
msg += "<CENTER><B>" + (*it).description() + "</B>"
+ "<BR>" + (*it).location() + "<BR>"
+ TimeString::dateString((*it).event().start(),ampm)
+ (warn
? tr(" (in " + QString::number(warn)
+ tr(" minutes)"))
: QString(""))
+ "<BR>"
+ (*it).notes() + "</CENTER>";
if ( (*it).event().alarmSound() != Event::Silent ) {
bSound = TRUE;
}
}
}
if ( found ) {
if ( bSound ) {
Sound::soundAlarm();
alarmCounter = 0;
stopTimer = startTimer( 5000 );
}
QDialog dlg( this, 0, TRUE );
QVBoxLayout *vb = new QVBoxLayout( &dlg );
QScrollView *view = new QScrollView( &dlg, "scrollView");
view->setResizePolicy( QScrollView::AutoOneFit );
vb->addWidget( view );
QLabel *lblMsg = new QLabel( msg, &dlg );
view->addChild( lblMsg );
QPushButton *cmdOk = new QPushButton( tr("OK"), &dlg );
connect( cmdOk, SIGNAL(clicked()), &dlg, SLOT(accept()) );
vb->addWidget( cmdOk );
-#if defined(Q_WS_QWS) || defined(_WS_QWS_)
- dlg.showMaximized();
-#endif
- needShow = dlg.exec();
+ needShow = QPEApplication::execDialog( &dlg );
if ( bSound )
killTimer( stopTimer );
}
}
} else if ( msg == "nextView()" ) {
needShow = true;
if ( !qApp-> activeWindow ( )) {
needShow = TRUE;
} else {
QWidget* cur = views->visibleWidget();
if ( cur ) {
if ( cur == dayView )
viewWeek();
else if ( cur == weekView )
viewWeekLst();
else if ( cur == weekLstView )
viewMonth();
else if ( cur == monthView )
viewDay();
needShow = TRUE;
}
}
} else if (msg == "editEvent(int)") {
/* simple copy from receive */
QDataStream stream(data,IO_ReadOnly);
int uid;
stream >> uid;
Event e=db->eventByUID(uid);
editEvent(e);
} else if (msg == "viewDefault(QDate)"){
/* simple copy from receive */
QDataStream stream(data,IO_ReadOnly);
QDate day;
stream >> day;
viewDefault(day);
needShow = true;
}
if ( needShow ) {
#if defined(Q_WS_QWS) || defined(_WS_QWS_)
// showMaximized();
#else
// show();
#endif
// raise();
QPEApplication::setKeepRunning();
// setActiveWindow();
@@ -857,100 +843,97 @@ void DateBook::slotNewEventFromKey( const QString &str )
start = end = d;
start.setTime( QTime( 10, 0 ) );
end.setTime( QTime( 12, 0 ) );
} else if ( views->visibleWidget() == weekView ) {
QDate d = weekView->date();
start = end = d;
start.setTime( QTime( 10, 0 ) );
end.setTime( QTime( 12, 0 ) );
} else if ( views->visibleWidget() == weekLstView ) {
QDate d = weekLstView->date();
start = end = d;
start.setTime( QTime( 10, 0 ) );
end.setTime( QTime( 12, 0 ) );
}
slotNewEntry(start, end, str);
}
void DateBook::slotNewEntry(const QDateTime &start, const QDateTime &end, const QString &str, const QString &location) {
// argh! This really needs to be encapsulated in a class
// or function.
QDialog newDlg( this, 0, TRUE );
newDlg.setCaption( DateEntryBase::tr("New Event") );
DateEntry *e;
QVBoxLayout *vb = new QVBoxLayout( &newDlg );
QScrollView *sv = new QScrollView( &newDlg );
sv->setResizePolicy( QScrollView::AutoOneFit );
sv->setFrameStyle( QFrame::NoFrame );
sv->setHScrollBarMode( QScrollView::AlwaysOff );
vb->addWidget( sv );
Event ev;
ev.setDescription( str );
// When the new gui comes in, change this...
if(location==0) {
if(defaultLocation.isEmpty()) {
ev.setLocation(tr("(Unknown)"));
} else {
ev.setLocation( defaultLocation );
}
} else {
ev.setLocation(location);
}
ev.setCategories(defaultCategories);
ev.setStart( start );
ev.setEnd( end );
e = new DateEntry( onMonday, ev, ampm, &newDlg );
e->setAlarmEnabled( aPreset, presetTime, Event::Loud );
sv->addChild( e );
-#if defined(Q_WS_QWS) || defined(_WS_QWS_)
- newDlg.showMaximized();
-#endif
- while (newDlg.exec()) {
+ while ( QPEApplication::execDialog( &newDlg ) ) {
ev = e->event();
ev.assignUid();
QString error = checkEvent( ev );
if ( !error.isNull() ) {
if ( QMessageBox::warning( this, tr("Error!"), error, tr("Fix it"), tr("Continue"), 0, 0, 1 ) == 0 )
continue;
}
db->addEvent( ev );
emit newEvent();
break;
}
}
void DateBook::setDocument( const QString &filename )
{
if ( filename.find(".vcs") != int(filename.length()) - 4 ) return;
QValueList<Event> tl = Event::readVCalendar( filename );
for( QValueList<Event>::Iterator it = tl.begin(); it != tl.end(); ++it ) {
db->addEvent( *it );
}
}
static const char * beamfile = "/tmp/obex/event.vcs";
void DateBook::beamEvent( const Event &e )
{
qDebug("trying to beamn");
unlink( beamfile ); // delete if exists
mkdir("/tmp/obex/", 0755);
Event::writeVCalendar( beamfile, e );
Ir *ir = new Ir( this );
connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) );
QString description = e.description();
ir->send( beamfile, description, "text/x-vCalendar" );
}
void DateBook::beamDone( Ir *ir )
{
delete ir;
unlink( beamfile );
}
void DateBook::slotFind()
{
// move it to the day view...
viewDay();
FindDialog frmFind( "Calendar", this ); // no tr needed
diff --git a/core/pim/datebook/dateentryimpl.cpp b/core/pim/datebook/dateentryimpl.cpp
index d9e5225..856837c 100644
--- a/core/pim/datebook/dateentryimpl.cpp
+++ b/core/pim/datebook/dateentryimpl.cpp
@@ -204,100 +204,97 @@ void DateEntry::init()
connect( startPicker, SIGNAL( dateClicked( int, int, int ) ),
this, SLOT( startDateChanged( int, int, int ) ) );
//Let start button change both start and end dates
connect( startPicker, SIGNAL( dateClicked( int, int, int ) ),
this, SLOT( endDateChanged( int, int, int ) ) );
connect( qApp, SIGNAL( clockChanged( bool ) ),
this, SLOT( slotChangeClock( bool ) ) );
connect( qApp, SIGNAL(weekChanged(bool)),
this, SLOT(slotChangeStartOfWeek(bool)) );
connect( editNote, SIGNAL(clicked()),
this, SLOT(slotEditNote()) );
QPopupMenu *m2 = new QPopupMenu( this );
endPicker = new DateBookMonth( m2, 0, TRUE );
m2->insertItem( endPicker );
buttonEnd->setPopup( m2 );
connect( endPicker, SIGNAL( dateClicked( int, int, int ) ),
this, SLOT( endDateChanged( int, int, int ) ) );
connect(timePickerStart, SIGNAL( timeChanged(const QTime &) ),
this, SLOT( startTimePicked(const QTime &) ));
// install eventFilters
comboEnd->installEventFilter( this );
comboStart->installEventFilter( this );
}
/*
* Destroys the object and frees any allocated resources
*/
DateEntry::~DateEntry()
{
// no need to delete child widgets, Qt does it all for us
//cout << "Del: " << comboStart->currentText() << endl;
}
/*
* public slot
*/
void DateEntry::slotEditNote() {
QString s;
s = "<B>"+ TimeString::longDateString( startDate ) + "</B>";
// s.sprintf("<B>%d/%d</B> ", startDate.day(), startDate.month());
NoteEntry noteDlg(s+comboDescription->currentText(), noteStr,
this,0,TRUE);
-#if defined(Q_WS_QWS) || defined(_WS_QWS_)
- noteDlg.showMaximized();
-#endif
- if (noteDlg.exec() ) {
+ if ( QPEApplication::execDialog( &noteDlg ) ) {
noteStr=noteDlg.note->text();
}
}
void DateEntry::endDateChanged( int y, int m, int d )
{
endDate.setYMD( y, m, d );
if ( endDate < startDate ) {
endDate = startDate;
}
buttonEnd->setText( TimeString::shortDate( endDate ) );
endPicker->setDate( endDate.year(), endDate.month(), endDate.day() );
}
static QTime parseTime( const QString& s, bool ampm )
{
QTime tmpTime;
QStringList l = QStringList::split( ':', s );
int hour = l[0].toInt();
if ( ampm ) {
int i=0;
while (i<int(l[1].length()) && l[1][i]>='0' && l[1][i]<='9')
i++;
QString digits = l[1].left(i);
if ( l[1].contains( "PM", FALSE ) ) {
if ( hour != 12 )
hour += 12;
} else {
if ( hour == 12 )
hour = 0;
}
l[1] = digits;
}
int minute = l[1].toInt();
if ( minute > 59 )
minute = 59;
else if ( minute < 0 )
minute = 0;
if ( hour > 23 ) {
hour = 23;
minute = 59;
} else if ( hour < 0 )
hour = 0;
tmpTime.setHMS( hour, minute, 0 );
return tmpTime;
@@ -350,100 +347,97 @@ void DateEntry::startDateChanged( int y, int m, int d )
*/
void DateEntry::startTimeEdited( const QString &s )
{
startTimeChanged(parseTime(s,ampm));
updateTimeEdit(false,true);
timePickerStart->setHour(startTime.hour());
timePickerStart->setMinute(startTime.minute());
}
void DateEntry::startTimeChanged( const QTime &t )
{
int duration=startTime.secsTo(endTime);
startTime = t;
endTime=t.addSecs(duration);
}
void DateEntry::startTimePicked( const QTime &t ) {
if(m_showStart ){
startTimeChanged(t);
updateTimeEdit(true,true);
}else{
endTimeChanged(t);
updateTimeEdit(false, true );
}
}
/*
* public slot
*/
void DateEntry::typeChanged( const QString &s )
{
bool b = s != "All Day";
buttonStart->setEnabled( b );
comboStart->setEnabled( b );
comboEnd->setEnabled( b );
}
void DateEntry::slotRepeat()
{
// Work around for compiler Bug..
RepeatEntry *e;
// it is better in my opinion to just grab this from the mother,
// since, this dialog doesn't need to keep track of it...
if ( rp.type != Event::NoRepeat )
e = new RepeatEntry( startWeekOnMonday, rp, startDate, this);
else
e = new RepeatEntry( startWeekOnMonday, startDate, this );
-#if defined(Q_WS_QWS) || defined(_WS_QWS_)
- e->showMaximized();
-#endif
- if ( e->exec() ) {
+ if ( QPEApplication::execDialog( e ) ) {
rp = e->repeatPattern();
setRepeatLabel();
}
// deleting sounds like a nice idea...
delete e;
}
void DateEntry::slotChangeStartOfWeek( bool onMonday )
{
startWeekOnMonday = onMonday;
}
Event DateEntry::event()
{
Event ev;
Event::SoundTypeChoice st;
ev.setDescription( comboDescription->currentText() );
ev.setLocation( comboLocation->currentText() );
ev.setCategories( comboCategory->currentCategories() );
ev.setType( checkAllDay->isChecked() ? Event::AllDay : Event::Normal );
if ( startDate > endDate ) {
QDate tmp = endDate;
endDate = startDate;
startDate = tmp;
}
// This is now done in the changed slots
// startTime = parseTime( comboStart->text(), ampm );
//endTime = parseTime( comboEnd->text(), ampm );
if ( startTime > endTime && endDate == startDate ) {
QTime tmp = endTime;
endTime = startTime;
startTime = tmp;
}
// don't set the time if theres no need too
if ( ev.type() == Event::AllDay ) {
startTime.setHMS( 0, 0, 0 );
endTime.setHMS( 23, 59, 59 );
}
// adjust start and end times based on timezone
QDateTime start( startDate, startTime );
QDateTime end( endDate, endTime );
time_t start_utc, end_utc;
// qDebug( "tz: %s", timezone->currentZone().latin1() );
diff --git a/core/pim/datebook2/mainwindow.cpp b/core/pim/datebook2/mainwindow.cpp
index be30415..7ff2204 100644
--- a/core/pim/datebook2/mainwindow.cpp
+++ b/core/pim/datebook2/mainwindow.cpp
@@ -184,114 +184,111 @@ void MainWindow::slotGoToNow() {
View* MainWindow::currentView() {
}
void MainWindow::slotFind() {
}
void MainWindow::slotConfigure() {
}
void MainWindow::slotClockChanged( bool ) {
}
void MainWindow::slotWeekChanged(bool ) {
}
void MainWindow::slotAppMessage( const QCString&, const QByteArray& ) {
}
void MainWindow::slotReceive( const QCString&, const QByteArray& ) {
}
BookManager* MainWindow::manager() {
return m_manager;
}
TemplateManager MainWindow::templateManager() {
return m_tempMan;
}
LocationManager MainWindow::locationManager() {
return m_locMan;
}
DescriptionManager MainWindow::descriptionManager() {
return m_descMan;
}
void MainWindow::setLocationManager( const LocationManager& loc) {
m_locMan = loc;
}
void MainWindow::setDescriptionManager( const DescriptionManager& dsc ) {
m_descMan = dsc;
}
Show* MainWindow::eventShow() {
return m_show;
}
void MainWindow::slotAction( QAction* act ) {
}
void MainWindow::slotConfigureLocs() {
LocationManagerDialog dlg( locationManager() );
dlg.setCaption( tr("Configure Locations") );
- dlg.showMaximized();
- if (dlg.exec() == QDialog::Accepted ) {
+ if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) {
setLocationManager( dlg.manager() );
}
}
void MainWindow::slotConfigureDesc() {
DescriptionManagerDialog dlg( descriptionManager() );
dlg.setCaption( tr("Configure Descriptions") );
- dlg.showMaximized();
- if (dlg.exec() == QDialog::Accepted ) {
+ if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) {
setDescriptionManager( dlg.manager() );
}
}
void MainWindow::slotConfigureTemp() {
TemplateDialog dlg( templateManager(), editor() );
dlg.setCaption( tr("Configure Templates") );
- dlg.showMaximized();
- if ( dlg.exec() == QDialog::Accepted ) {
+ if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) {
m_tempMan = dlg.manager();
setTemplateMenu();
}
}
void MainWindow::hideShow() {
}
void MainWindow::viewPopup(int ) {
}
void MainWindow::viewAdd(const QDate& ) {
}
void MainWindow::viewAdd( const QDateTime&, const QDateTime& ) {
}
bool MainWindow::viewAP()const{
}
bool MainWindow::viewStartMonday()const {
}
void MainWindow::setTemplateMenu() {
m_popTemplate->clear();
QStringList list = templateManager().names();
for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) {
m_popTemplate->insertItem( (*it) );
}
}
/*
* get the name of the item with the id id
* then ask for an OEvent from the manager
*/
void MainWindow::slotNewFromTemplate(int id ) {
QString name = m_popTemplate->text( id );
OEvent ev = templateManager().value( name );
if ( editor()->edit( ev ) ) {
ev = editor()->event();
ev.setUid( -1 );
manager()->add( ev );
/*
* no we'll find out if the current view
* should show the new event
* and then we will ask it to refresh
* FIXME for now we'll call a refresh
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp
index d06a405..fc189bd 100644
--- a/core/pim/todo/mainwindow.cpp
+++ b/core/pim/todo/mainwindow.cpp
@@ -983,63 +983,62 @@ void MainWindow::handleAlarms( const OTodo& oldTodo, const OTodo& newTodo) {
removeAlarms( removed, oldTodo.uid() );
}
if ( newTodo.hasNotifiers() ) {
OPimNotifyManager::Alarms added;
if ( oldTodo.isEmpty() || !oldTodo.hasNotifiers() )
added = newTodo.notifiers().alarms();
else
added = findNonMatching( newTodo.notifiers().alarms(), oldTodo.notifiers().alarms() );
addAlarms( added, newTodo.uid() );
}
}
/* we might have not loaded the db */
void MainWindow::doAlarm( const QDateTime& dt, int uid ) {
m_todoMgr.load();
OTodo todo = m_todoMgr.event( uid );
if (!todo.hasNotifiers() ) return;
/*
* let's find the right alarm and find out if silent
* then show a richtext widget
*/
bool loud = false;
OPimNotifyManager::Alarms als = todo.notifiers().alarms();
OPimNotifyManager::Alarms::Iterator it;
for ( it = als.begin(); it != als.end(); ++it ) {
if ( (*it).dateTime() == dt ) {
loud = ( (*it).sound() == OPimAlarm::Loud );
break;
}
}
if (loud)
startAlarm();
QDialog dlg(this, 0, TRUE );
QVBoxLayout* lay = new QVBoxLayout( &dlg );
QTextView* view = new QTextView( &dlg );
lay->addWidget( view );
QPushButton* btnOk = new QPushButton( tr("Ok"), &dlg );
connect( btnOk, SIGNAL(clicked() ), &dlg, SLOT(accept() ) );
lay->addWidget( btnOk );
QString text = tr("<h1>Alarm at %1</h1><br>").arg( TimeString::dateString( dt ) );
text += todo.toRichText();
view->setText( text );
- dlg.showMaximized();
- bool needToStay = dlg.exec();
+ bool needToStay = QPEApplication::execDialog( &dlg );
if (loud)
killAlarm();
if (needToStay) {
// showMaximized();
// raise();
QPEApplication::setKeepRunning();
// setActiveWindow();
}
}
diff --git a/core/pim/todo/todoeditor.cpp b/core/pim/todo/todoeditor.cpp
index c204325..78aedd6 100644
--- a/core/pim/todo/todoeditor.cpp
+++ b/core/pim/todo/todoeditor.cpp
@@ -1,63 +1,62 @@
+#include <qpe/qpeapplication.h>
+
#include "otaskeditor.h"
#include "todoeditor.h"
using namespace Todo;
Editor::Editor() {
m_accepted = false;
m_self = 0l;
}
Editor::~Editor() {
delete m_self;
m_self = 0;
}
OTodo Editor::newTodo( int cur,
QWidget*) {
OTaskEditor *e = self();
e->setCaption( QObject::tr("Enter Task") );
e->init( cur );
+ int ret = QPEApplication::execDialog( e );
- e->showMaximized();
-
- int ret = e->exec();
if ( QDialog::Accepted == ret ) {
m_accepted = true;
}else
m_accepted = false;
OTodo ev = e->todo();
qWarning("Todo uid");
qWarning("Todo %s %d %d", ev.summary().latin1(), ev.progress(), ev.isCompleted() );
ev.setUid(1);
return ev;
}
OTodo Editor::edit( QWidget *,
const OTodo& todo ) {
OTaskEditor *e = self();
e->init( todo );
e->setCaption( QObject::tr( "Edit Task" ) );
- e->showMaximized();
- int ret = e->exec();
+ int ret = QPEApplication::execDialog( e );
OTodo ev = e->todo();
if ( ret == QDialog::Accepted )
m_accepted = true;
else
m_accepted = false;
return ev;
}
bool Editor::accepted()const {
return m_accepted;
}
OTaskEditor* Editor::self() {
if (!m_self )
m_self = new OTaskEditor(0);
return m_self;
}
diff --git a/core/settings/light-and-power/light.cpp b/core/settings/light-and-power/light.cpp
index d6d09a1..b21215b 100644
--- a/core/settings/light-and-power/light.cpp
+++ b/core/settings/light-and-power/light.cpp
@@ -1,83 +1,84 @@
/*
This file is part of the OPIE Project
               =. Copyright (c) 2002 Maximilian Reiss <harlekin@handhelds.org>
             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
           .>+-=
 _;:,     .>    :=|. This file is free software; you can
.> <`_,   >  .   <= redistribute it and/or modify it under
:`=1 )Y*s>-.--   : the terms of the GNU General Public
.="- .-=="i,     .._ License as published by the Free Software
 - .   .-<_>     .<> Foundation; either version 2 of the License,
     ._= =}       : or (at your option) any later version.
    .%`+i>       _;_.
    .i_,=:_.      -<s. This file 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 file;
  -_. . .   )=.  = see the file COPYING. If not, write to the
    --        :-=` Free Software Foundation, Inc.,
59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "light.h"
#include <qpe/config.h>
#include <qpe/power.h>
#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
#include <qpe/qcopenvelope_qws.h>
#endif
+#include <qpe/qpeapplication.h>
#include <qlabel.h>
#include <qcheckbox.h>
#include <qtabwidget.h>
#include <qslider.h>
#include <qspinbox.h>
#include <qpushbutton.h>
#include <qgroupbox.h>
#include <qcombobox.h>
#include <opie/odevice.h>
#include "sensor.h"
using namespace Opie;
LightSettings::LightSettings( QWidget* parent, const char* name, WFlags )
: LightSettingsBase( parent, name, false, WStyle_ContextHelp )
{
m_bres = ODevice::inst ( )-> displayBrightnessResolution ( );
m_cres = ODevice::inst ( )-> displayContrastResolution ( );
// check whether to show the light sensor stuff
if ( !ODevice::inst ( )-> hasLightSensor ( )) {
auto_brightness-> hide ( );
CalibrateLightSensor-> hide ( );
auto_brightness_ac-> hide ( );
CalibrateLightSensor_ac-> hide ( );
}
// check whether to show the contrast stuff
if (m_cres) {
GroupLight->setTitle(tr("Backlight && Contrast"));
GroupLight_ac->setTitle(GroupLight->title());
} else {
contrast->hide();
contrast_ac->hide();
}
// check whether to show the cpu frequency stuff
QStrList freq = ODevice::inst()->allowedCpuFrequencies();
if ( freq.count() ) {
frequency->insertStrList( freq );
frequency_ac->insertStrList( freq );
} else {
@@ -156,98 +157,97 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags )
if (m_cres) {
contr = config. readNumEntry ( "Contrast", 127);
contrast_ac-> setTickInterval ( QMAX( 16, 256 / m_cres ));
contrast_ac-> setLineStep ( QMAX( 1, 256 / m_cres ));
contrast_ac-> setPageStep ( QMAX( 1, 256 / m_cres ));
contrast_ac-> setValue ( contr );
}
// light sensor
auto_brightness_ac-> setChecked ( config. readBoolEntry ( "LightSensor", false ));
m_sensordata_ac = config. readListEntry ( "LightSensorData", ';' );
// warnings
config. setGroup ( "Warnings" );
warnintervalBox-> setValue ( config. readNumEntry ( "checkinterval", 10000 ) / 1000 );
lowSpinBox-> setValue ( config. readNumEntry ( "powerverylow", 10 ) );
criticalSpinBox-> setValue ( config. readNumEntry ( "powercritical", 5 ) );
m_resettimer = new QTimer ( this );
connect ( m_resettimer, SIGNAL( timeout ( )), this, SLOT( resetBacklight ( )));
if ( PowerStatusManager::readStatus ( ). acStatus ( ) != PowerStatus::Online ) {
tabs-> setCurrentPage ( 0 );
}
else {
tabs-> setCurrentPage ( 1 );
}
connect ( brightness, SIGNAL( valueChanged ( int )), this, SLOT( setBacklight ( int )));
connect ( brightness_ac, SIGNAL( valueChanged ( int )), this, SLOT( setBacklight ( int )));
if (m_cres) {
connect ( contrast, SIGNAL( valueChanged ( int )), this, SLOT( setContrast ( int )));
connect ( contrast_ac, SIGNAL( valueChanged ( int )), this, SLOT( setContrast ( int )));
}
connect( frequency, SIGNAL( activated(int) ), this, SLOT( setFrequency(int) ) );
connect( frequency_ac, SIGNAL( activated(int) ), this, SLOT( setFrequency(int) ) );
connect( closeHingeAction, SIGNAL( activated(int) ), this, SLOT( setCloseHingeAction(int) ) );
connect( closeHingeAction_ac, SIGNAL( activated(int) ), this, SLOT( setCloseHingeAction(int) ) );
}
LightSettings::~LightSettings ( )
{
}
void LightSettings::calibrateSensor ( )
{
Sensor *s = new Sensor ( m_sensordata, this );
connect ( s, SIGNAL( viewBacklight ( int )), this, SLOT( setBacklight ( int )));
- s-> showMaximized ( );
- s-> exec ( );
+ QPEApplication::execDialog( s );
delete s;
}
void LightSettings::calibrateSensorAC ( )
{
Sensor *s = new Sensor ( m_sensordata_ac, this );
connect ( s, SIGNAL( viewBacklight ( int )), this, SLOT( setBacklight ( int )));
s-> showMaximized ( );
s-> exec ( );
delete s;
}
void LightSettings::setBacklight ( int bright )
{
QCopEnvelope e ( "QPE/System", "setBacklight(int)" );
e << bright;
if ( bright != -1 ) {
m_resettimer-> stop ( );
m_resettimer-> start ( 4000, true );
}
}
void LightSettings::setContrast ( int contr )
{
if (contr == -1) contr = m_oldcontrast;
ODevice::inst ( )-> setDisplayContrast(contr);
}
void LightSettings::setFrequency ( int index )
{
qWarning("LightSettings::setFrequency(%d)", index);
ODevice::inst ( )-> setCurrentCpuFrequency(index);
}
void LightSettings::resetBacklight ( )
{
setBacklight ( -1 );
setContrast ( -1 );
}
void LightSettings::setCloseHingeAction ( int index )
{
qWarning("LightSettings::setCloseHingeStatus(%d)", index);
}
void LightSettings::accept ( )
{