summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2003-10-27 18:45:36 (UTC)
committer mickeyl <mickeyl>2003-10-27 18:45:36 (UTC)
commitdf9d9d818c9667ba8e614e5c09f0e121e9225dfd (patch) (side-by-side diff)
treefff36af7df853c64c68c839f5fdd9d065ff14e86
parent96a577bb03db6ccbf1a10b03116d3b868233df0e (diff)
downloadopie-df9d9d818c9667ba8e614e5c09f0e121e9225dfd.zip
opie-df9d9d818c9667ba8e614e5c09f0e121e9225dfd.tar.gz
opie-df9d9d818c9667ba8e614e5c09f0e121e9225dfd.tar.bz2
merge noncore/applets/*
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/applets/notesapplet/notes.cpp29
-rw-r--r--noncore/applets/notesapplet/notes.h4
-rw-r--r--noncore/applets/notesapplet/notesappletimpl.cpp1
3 files changed, 17 insertions, 17 deletions
diff --git a/noncore/applets/notesapplet/notes.cpp b/noncore/applets/notesapplet/notes.cpp
index 4e98b31..e2b0c2a 100644
--- a/noncore/applets/notesapplet/notes.cpp
+++ b/noncore/applets/notesapplet/notes.cpp
@@ -34,147 +34,145 @@
#include <qmultilineedit.h>
#include <qlistbox.h>
#include <qpopupmenu.h>
#include <qmessagebox.h>
#include <qdir.h>
#include <qfile.h>
#include <qpoint.h>
#include <qpushbutton.h>
#include <qpainter.h>
#include <qlayout.h>
#include <qframe.h>
#include <qpixmap.h>
#include <qstring.h>
#include <qtimer.h>
/* XPM */
static char * notes_xpm[] = {
"16 16 11 1",
" c None",
". c #000000",
"+ c #7F7F7F",
"@ c #BFBFBF",
"# c #BFC1FF",
"$ c #FF0000",
"% c #FFFFFF",
"& c #00037F",
"* c #0006FF",
"= c #0005BF",
"- c #7F0000",
" .. ",
" .. ",
" ... ",
" .+ ",
" .@. ",
" . .+ ",
" ..#.@. ",
" ..###.+.. ",
" ..###$...##.. ",
"..###$$$%+$$##&.",
".*=####$-###&=&.",
".=**=###==&=&=..",
" ..=**=#&=&=.. ",
" ..=*=&=.. ",
" ..=.. ",
" . "};
-NotesControl::NotesControl( QWidget *parent, const char *name )
- : QFrame( parent, name,/* WDestructiveClose | */WStyle_StaysOnTop )
+NotesControl::NotesControl( QWidget *, const char * )
+ : QVBox( 0, "NotesControl",/* WDestructiveClose | */WStyle_StaysOnTop )
// : QFrame( parent, name, WDestructiveClose | WStyle_StaysOnTop | WType_Popup )
{
QDir d( QDir::homeDirPath()+"/notes");
if( !d.exists()) {
qDebug("make dir");
if(!d.mkdir( QDir::homeDirPath()+"/notes", true))
qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<make dir failed");
}
Config cfg("Notes");
cfg.setGroup("Options");
showMax = cfg.readBoolEntry("ShowMax", false);
setFrameStyle( QFrame::PopupPanel | QFrame::Raised );
loaded=false;
edited=false;
doPopulate=true;
isNew=false;
- QVBoxLayout *vbox = new QVBoxLayout( this,0, -1, "Vlayout" );
- QHBoxLayout *hbox = new QHBoxLayout( this, 0, -1, "HLayout" );
+ QVBox *vbox = new QVBox( this, "Vlayout" );
+ QHBox *hbox = new QHBox( this, "HLayout" );
- view = new QMultiLineEdit(this, "OpieNotesView");
+ view = new QMultiLineEdit(vbox, "OpieNotesView");
- box = new QListBox(this, "OpieNotesBox");
+ box = new QListBox(vbox, "OpieNotesBox");
QPEApplication::setStylusOperation( box->viewport(),QPEApplication::RightOnHold);
box->setFixedHeight(50);
vbox->setMargin( 6 );
vbox->setSpacing( 3 );
- vbox->addWidget( view);
- vbox->addWidget( box);
+
setFocusPolicy(QWidget::StrongFocus);
- newButton= new QPushButton( this, "newButton" );
+ newButton= new QPushButton( hbox, "newButton" );
newButton->setText(tr("New"));
- hbox->addWidget( newButton);
- saveButton= new QPushButton( this, "saveButton" );
+
+ saveButton= new QPushButton( hbox, "saveButton" );
saveButton->setText(tr("Save"));
- hbox->addWidget( saveButton);
- deleteButton= new QPushButton( this, "deleteButton" );
+
+ deleteButton= new QPushButton( hbox, "deleteButton" );
deleteButton->setText(tr("Delete"));
- hbox->addWidget( deleteButton);
- vbox->addItem(hbox);
+
connect( box, SIGNAL( mouseButtonPressed( int, QListBoxItem *, const QPoint&)),
this,SLOT( boxPressed(int, QListBoxItem *, const QPoint&)) );
connect(box, SIGNAL(highlighted(const QString&)), this, SLOT(slotBoxSelected(const QString &)));
connect( &menuTimer, SIGNAL( timeout() ), SLOT( showMenu() ) );
connect(view,SIGNAL( textChanged() ), this, SLOT(slotViewEdited() ) );
connect(newButton, SIGNAL(clicked()), this, SLOT(slotNewButton()));
connect(saveButton, SIGNAL(clicked()), this, SLOT(slotSaveButton()));
connect(deleteButton, SIGNAL(clicked()), this, SLOT(slotDeleteButtonClicked()));
populateBox();
load();
setCaption("Notes");
// parent->setFocus();
}
void NotesControl::slotSaveButton() {
slotNewButton();
populateBox();
}
void NotesControl::slotDeleteButtonClicked() {
switch ( QMessageBox::warning(this,tr("Delete?")
,tr("Do you really want to<BR><B> delete</B> this note ?")
,tr("Yes"),tr("No"),0,1,1) ) {
case 0:
slotDeleteButton();
break;
};
}
void NotesControl::slotDeleteButton() {
QString selectedText = box->currentText();
qDebug("deleting "+selectedText);
if( !selectedText.isEmpty()) {
Config cfg("Notes");
cfg.setGroup("Docs");
int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 );
QString entryName, entryName2;;
for ( int i = 0; i < noOfFiles; i++ ) {
entryName.sprintf( "File%i", i + 1 );
@@ -423,86 +421,87 @@ void NotesControl::slotShowMax() {
showMax=!showMax;
cfg.writeEntry("ShowMax", showMax);
cfg.write();
hide();
}
void NotesControl::slotSearch() {
int boxCount = box->count();
for(int i=0;i< boxCount;i++) {
}
}
// void NotesControl::keyReleaseEvent( QKeyEvent *e) {
// switch ( e->state() ) {
// case ControlButton:
// if(e->key() == Key_C) { //copy
// qDebug("copy");
// QClipboard *cb = QApplication::clipboard();
// QString text;
// // Copy text from the clipboard (paste)
// text = cb->text();
// }
// if(e->key() == Key_X) { //cut
// }
// if(e->key() == Key_V) { //paste
// QClipboard *cb = QApplication::clipboard();
// QString text;
// //view
// cb->setText();
// }
// break;
// };
// QWidget::keyReleaseEvent(e);
// }
//===========================================================================
NotesApplet::NotesApplet( QWidget *parent, const char *name )
: QWidget( parent, name ) {
setFixedHeight( 18 );
setFixedWidth( 14 );
vc = new NotesControl;
}
NotesApplet::~NotesApplet() {
+ delete vc;
}
void NotesApplet::mousePressEvent( QMouseEvent *) {
if( !vc->isHidden()) {
vc->doPopulate=false;
vc->save();
vc->close();
} else {
// vc = new NotesControl;
// QPoint curPos = mapToGlobal( rect().topLeft() );
if(vc->showMax) {
qDebug("show max");
vc->showMaximized();
} else {
qDebug("no show max");
QWidget *wid = QPEApplication::desktop();
QRect rect = QApplication::desktop()->geometry();
vc->setGeometry( ( wid->width() / 2) - ( vc->width() / 2 ) , 28 , wid->width() -10 , 180);
vc->move ( (rect.center()/2) - (vc->rect().center()/2));
// vc->move( (( wid->width() / 2) - ( vc->width() / 2 ))-4, 28);
}
vc->show();
vc->doPopulate=true;
vc->populateBox();
vc->doPopulate=false;
vc->loaded=false;
vc->load();
// this->setFocus();
vc->view->setFocus();
}
}
void NotesApplet::paintEvent( QPaintEvent* ) {
QPainter p(this);
p.drawPixmap( 0, 1, ( const char** ) notes_xpm );
}
diff --git a/noncore/applets/notesapplet/notes.h b/noncore/applets/notesapplet/notes.h
index c428efe..08253cb 100644
--- a/noncore/applets/notesapplet/notes.h
+++ b/noncore/applets/notesapplet/notes.h
@@ -1,82 +1,82 @@
/**********************************************************************
** Copyright (C) 2002 L.J. Potter ljp@llornkcor.com
** All rights reserved.
**
** 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.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
**********************************************************************/
#ifndef __NOTES_APPLET_H__
#define __NOTES_APPLET_H__
#include <qwidget.h>
-#include <qframe.h>
+#include <qvbox.h>
#include <qpixmap.h>
#include <qguardedptr.h>
#include <qtimer.h>
#include <qpe/filemanager.h>
#include <qpe/ir.h>
#include <qstring.h>
class QComboBox;
class QCheckBox;
class QSpinBox;
class QPushButton;
class QMultiLineEdit;
class QListBox;
class QListBoxItem;
-class NotesControl : public QFrame {
+class NotesControl : public QVBox {
Q_OBJECT
public:
NotesControl( QWidget *parent=0, const char *name=0 );
QPixmap notes;
QMultiLineEdit *view;
QListBox *box;
QPushButton *saveButton, *deleteButton, *newButton;
QString FileNamePath;
bool loaded, edited, doPopulate, isNew;
bool showMax;
void save();
void populateBox();
void load();
private:
QTimer menuTimer;
DocLnk *doc;
QString oldDocName;
void focusOutEvent( QFocusEvent * );
void load(const QString&);
private slots:
void slotSearch();
void slotShowMax();
void slotBeamButton();
void slotBeamFinished( Ir*);
void slotDeleteButton();
void slotSaveButton();
void slotDeleteButtonClicked();
void slotNewButton();
void boxPressed(int, QListBoxItem *, const QPoint&);
void showMenu();
void loadDoc( const DocLnk &);
void slotViewEdited();
void slotBoxSelected(const QString &);
// void keyReleaseEvent( QKeyEvent *);
};
class NotesApplet : public QWidget {
Q_OBJECT
public:
NotesApplet( QWidget *parent = 0, const char *name=0 );
~NotesApplet();
NotesControl *vc;
public slots:
private:
void mousePressEvent( QMouseEvent * );
diff --git a/noncore/applets/notesapplet/notesappletimpl.cpp b/noncore/applets/notesapplet/notesappletimpl.cpp
index 93e1e97..0526bad 100644
--- a/noncore/applets/notesapplet/notesappletimpl.cpp
+++ b/noncore/applets/notesapplet/notesappletimpl.cpp
@@ -1,50 +1,51 @@
/**********************************************************************
** Copyright (C) 2002 L.J. Potter <llornkcor@handhelds.org>
**
**
** 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.
**
**
**********************************************************************/
#include "notes.h"
#include "notesappletimpl.h"
NotesAppletImpl::NotesAppletImpl()
: notes(0), ref(0) {
}
NotesAppletImpl::~NotesAppletImpl() {
+ // not needed though cause we should have a valid parent
delete notes;
}
QWidget *NotesAppletImpl::applet( QWidget *parent ) {
if ( !notes )
notes = new NotesApplet( parent );
return notes;
}
int NotesAppletImpl::position() const {
return 6;
}
QRESULT NotesAppletImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) {
*iface = 0;
if ( uuid == IID_QUnknown )
*iface = this;
else if ( uuid == IID_TaskbarApplet )
*iface = this;
if ( *iface )
(*iface)->addRef();
return QS_OK;
}
Q_EXPORT_INTERFACE() {
Q_CREATE_INSTANCE( NotesAppletImpl )
}