summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-11-21 00:54:20 (UTC)
committer llornkcor <llornkcor>2002-11-21 00:54:20 (UTC)
commita65963a06def8cb064bf7d99ff2776877f5f6315 (patch) (side-by-side diff)
tree1134ef93e2ee628b4bcff73b0d0965266439d073
parent9cef034e112118ad388b0678cd492d81b1695021 (diff)
downloadopie-a65963a06def8cb064bf7d99ff2776877f5f6315.zip
opie-a65963a06def8cb064bf7d99ff2776877f5f6315.tar.gz
opie-a65963a06def8cb064bf7d99ff2776877f5f6315.tar.bz2
changed title, added maximixed mode. save to /notes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/applets/notesapplet/notes.cpp70
-rw-r--r--noncore/applets/notesapplet/notes.h3
2 files changed, 57 insertions, 16 deletions
diff --git a/noncore/applets/notesapplet/notes.cpp b/noncore/applets/notesapplet/notes.cpp
index 90c2550..2b25476 100644
--- a/noncore/applets/notesapplet/notes.cpp
+++ b/noncore/applets/notesapplet/notes.cpp
@@ -85,3 +85,13 @@ NotesControl::NotesControl( QWidget *parent, const char *name )
{
- setFrameStyle( QFrame::PopupPanel | QFrame::Raised );
+ 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;
@@ -107,6 +117,2 @@ NotesControl::NotesControl( QWidget *parent, const char *name )
- setFixedHeight(180);
- QWidget *wid = QPEApplication::desktop();
- setFixedWidth( wid->width()-10 /*200*/);
-
setFocusPolicy(QWidget::StrongFocus);
@@ -255,4 +261,5 @@ void NotesControl::showMenu() {
QPopupMenu *m = new QPopupMenu(0);
-
m->insertItem( tr( "Beam Out" ), this, SLOT( slotBeamButton() ));
+ m->insertItem( tr( "Search For..." ), this, SLOT( slotSearch() ));
+ m->insertItem( tr( "Toggle Maximized" ), this, SLOT( slotShowMax() ));
m->insertSeparator();
@@ -263,3 +270,2 @@ void NotesControl::showMenu() {
if(m) delete m;
-
}
@@ -286,6 +292,6 @@ void NotesControl::save() {
QString pt = rt.simplifyWhiteSpace();
- int i = pt.find( ' ' );
+ int i = pt.find( ' ', pt.find( ' ' )+2 );
QString docname = pt;
if ( i > 0 )
- docname = pt.left( i );
+ docname = pt.left(i);
// remove "." at the beginning
@@ -313,5 +319,3 @@ void NotesControl::save() {
-
doc = new DocLnk(docname);
-
if(QFile(doc->linkFile()).exists())
@@ -319,5 +323,5 @@ void NotesControl::save() {
doc->setType("text/plain");
- doc->setFile(QDir::homeDirPath()+"/"+docname);
doc->setName(docname);
-
+ QString temp = docname.replace( QRegExp(" "), "_" );
+ doc->setFile( QDir::homeDirPath()+"/notes/"+temp);
FileManager fm;
@@ -376,6 +380,12 @@ void NotesControl::load(const QString & file) {
qDebug("loading "+file);
- if(!loaded) {
+ QString name = file;
+ QString temp;
+ if( !QFile( QDir::homeDirPath()+"/"+file).exists() )
+ temp = QDir::homeDirPath()+"/notes/"+ name.replace( QRegExp(" "), "_" );
+ else
+ temp = name;
+ if(!loaded) {
DocLnk nf;
nf.setType("text/plain");
- nf.setFile( file);
+ nf.setFile( temp);
@@ -396,2 +406,3 @@ void NotesControl::loadDoc( const DocLnk &f) {
if ( !fm.loadFile( f, txt ) ) {
+ qDebug("could not load file "+f.file());
return;
@@ -407,2 +418,19 @@ void NotesControl::slotViewEdited() {
+
+void NotesControl::slotShowMax() {
+ Config cfg("Notes");
+ cfg.setGroup("Options");
+ 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) {
@@ -452,4 +480,14 @@ void NotesApplet::mousePressEvent( QMouseEvent *) {
// 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->move( 2, 28);
vc->doPopulate=true;
diff --git a/noncore/applets/notesapplet/notes.h b/noncore/applets/notesapplet/notes.h
index 381dc80..c428efe 100644
--- a/noncore/applets/notesapplet/notes.h
+++ b/noncore/applets/notesapplet/notes.h
@@ -44,2 +44,3 @@ public:
bool loaded, edited, doPopulate, isNew;
+ bool showMax;
void save();
@@ -55,2 +56,4 @@ private:
private slots:
+ void slotSearch();
+ void slotShowMax();
void slotBeamButton();