Source Code (Use browser search to find items of interest.)
Class Index
knotes'KPostit (./kdeutils/knotes/knotes.h:112)
class KPostit :public QFrame{
Q_OBJECT
public:
KPostit(QWidget *parent=0, const char *wname=0,int number=0,
QString pname="");
~KPostit( void );
// one instance for all kpostits
static QList<KPostit> PostitList;
static QStringList PostitFilesList;
static QList<AlarmEntry> AlarmList;
static bool dock;
int number;
bool hidden;
QString name;
QString propertystring;
QLabel* label;
myPushButton* mybutton;
KPostitMultilineEdit* edit;
QPopupMenu *right_mouse_button;
protected:
bool eventFilter( QObject *, QEvent * );
void resizeEvent( QResizeEvent * );
void closeEvent( QCloseEvent * );
public slots:
void set3DFrame(bool enable);
void toggleFrame();
void toggleDock();
void set_colors();
void set_background_color();
void set_foreground_color();
void clear_text();
bool loadnotes();
bool savenotes();
void quit();
void undo();
void redo();
void insertDate();
void insertNetFile( const char *_url);
bool insertFile(const QString &filename);
void RMBActivated(int);
void close();
void selectFont();
void findKPostit(int );
void newKPostit();
void renameKPostit();
void deleteKPostit();
void hideKPostit();
void insertCalendar();
void mail();
void print();
void save_all();
void defaults();
void setAlarm();
void help();
void toggleIndentMode();
void toggleOnTopMode();
void toDesktop(int);
void toggleSticky();
private slots:
void configurationChanged( const DefStruct &state );
private:
void setAutoIndent();
void setNoAutoIndent();
void setOnTop(bool enable);
private:
QFont font;
QPopupMenu *colors;
QPopupMenu *options;
QPopupMenu *operations;
QPopupMenu *desktops;
int frame3dID;
int onTopID;
int dockID;
QColor forecolor;
QColor backcolor;
QTimer *timer;
bool frame3d;
QPoint pointerOffset;
bool dragging;
int sticky_id;
OptionDialog *mOptionDialog;
};
knotes'KPostit::KPostit() (./kdeutils/knotes/knotes.cpp:279)
KPostit::KPostit( QWidget *parent, const char *myname, int _number,
QString pname)
: QFrame(parent, myname), mOptionDialog(0)
{
XSetTransientForHint(qt_xdisplay(), winId(), winId());
KWM::setWmCommand(winId(), "");
KWM::setDecoration(winId(), KWM::tinyDecoration);
KWM::setIcon(winId(), kapp->icon());
KWM::setMiniIcon(winId(), kapp->miniIcon());
label = new QLabel(this);
label->setText(i18n("Hello"));
label->setAlignment( AlignHCenter);
label->installEventFilter(this);
dragging = false;
mybutton = new myPushButton(this);
mybutton->setGeometry(200-30,0,30,30);
mybutton->setPixmap(BarIcon("knotesclose"));
connect(mybutton,SIGNAL(clicked()),this,SLOT(hideKPostit()));
edit = new KPostitMultilineEdit(this);
edit->setGeometry(0,30,200,100);
edit->installEventFilter(this);
edit->setFocus();
edit->setFrameStyle(QFrame::NoFrame);
connect(edit, SIGNAL(gotUrlDrop(const char*)),
this, SLOT(insertNetFile(const char*)));
hidden = false;
number = _number; // index in popup. Not used anymore, but I'll leave it in
// the structure for now.
name = pname; // name of postit and name on the popup
//set the defaults
forecolor = postitdefaults.forecolor;
backcolor = postitdefaults.backcolor;
edit->autoIndentMode = postitdefaults.autoindent;
font = postitdefaults.font;
frame3d = postitdefaults.frame3d;
resize(postitdefaults.width,postitdefaults.height + 30);
edit->resize(postitdefaults.width,postitdefaults.height);
loadnotes();
colors = new QPopupMenu();
colors->insertItem(i18n("Text Color..."),
this, SLOT(set_foreground_color()));
colors->insertItem(i18n("Background Color..."),
this, SLOT(set_background_color()));
operations = new QPopupMenu();
operations->insertItem (i18n("New Note"), this,SLOT(newKPostit()));
operations->insertItem (i18n("Delete Note"), this,SLOT(deleteKPostit()));
operations->insertItem (i18n("Rename Note..."),this,SLOT(renameKPostit()));
operations->insertSeparator();
operations->insertItem (i18n("Alarm ..."), this,SLOT(setAlarm()));
operations->insertSeparator();
operations->insertItem (i18n("Insert Date"), this, SLOT(insertDate()));
operations->insertItem (i18n("Insert Calendar"),this,SLOT(insertCalendar()));
operations->insertItem (i18n("Mail Note ..."), this,SLOT(mail()));
operations->insertItem (i18n("Print Note"), this,SLOT(print()));
operations->insertItem (i18n("Save Notes"), this,SLOT(save_all()));
options = new QPopupMenu();
options->setCheckable(TRUE);
frame3dID = options->insertItem(i18n("3D Frame"),
this,SLOT(toggleFrame()));
onTopID = options->insertItem(i18n("Always visible"),
this,SLOT(toggleOnTopMode()));
edit->autoIndentID = options->insertItem(i18n("Auto Indent"),
this, SLOT(toggleIndentMode()));
options->insertItem(i18n("Font..."),
this, SLOT(selectFont()));
options->insertItem(i18n("Colors"),colors);
options->insertSeparator();
options->insertItem(i18n("Configuration..."),
this, SLOT(defaults()));
dockID = options->insertItem(i18n("Dock in panel"),
this, SLOT(toggleDock()));
operations->insertSeparator();
operations->insertItem( i18n("Help"), this, SLOT(help()) );
operations->insertItem( i18n("Quit"), this, SLOT(quit()) );
right_mouse_button = new QPopupMenu;
KContextMenuManager::insert( edit, right_mouse_button );
for ( uint i = 0; i < PostitFilesList.count(); i++)
{
int k = right_mouse_button->insertItem (PostitFilesList[i]);
k = k;
}
connect( right_mouse_button, SIGNAL(activated( int )),
SLOT(RMBActivated(int)) );
right_mouse_button->insertSeparator();
right_mouse_button->insertItem (i18n("Undo"), this,
SLOT(undo()) );
right_mouse_button->insertItem (i18n("Redo"), this,
SLOT(redo()) );
right_mouse_button->insertSeparator();
right_mouse_button->insertItem(i18n("Clear"),this, SLOT(clear_text()));
right_mouse_button->insertSeparator();
right_mouse_button->insertItem (i18n("Operations"),operations);
right_mouse_button->insertItem (i18n("Options"),options);
//right_mouse_button->insertSeparator();
//sticky_id = right_mouse_button->insertItem("", this, SLOT(toggleSticky()));
desktops = new QPopupMenu;
connect( desktops, SIGNAL(activated( int )), SLOT(toDesktop(int)) );
right_mouse_button->insertItem(i18n("&To desktop"), desktops );
installEventFilter( this );
window_id = winId();
set3DFrame(frame3d);
setOnTop(postitdefaults.onTop);
if(edit->autoIndentMode==false)
{
setNoAutoIndent();
options->setItemChecked(edit->autoIndentID,FALSE);
}
else
{
setAutoIndent();
options->setItemChecked(edit->autoIndentID,TRUE);
}
options->setItemChecked(dockID,dock);
set_colors();
connect(kapp,SIGNAL(kdisplayPaletteChanged()),this,SLOT(set_colors()));
edit->setFont(font);
bool have_alarm = false;
QListIterator<AlarmEntry> it( AlarmList );
AlarmEntry *entry;
while( (entry=it.current()) )
{
if(entry->name == name)
{
have_alarm = TRUE;
break;
}
++it;
}
if (have_alarm)
{
label->setText(name + " (A)");
setCaption(i18n("Note: ") + name + " (A)");
}
else
{
label->setText(name);
setCaption(i18n("Note: ") + name);
}
// add some keyboard accelerators (pfeiffer)
KAccel *accel = new KAccel(this, "kaccel");
accel->connectItem(KStdAccel::New, this, SLOT(newKPostit()));
accel->connectItem(KStdAccel::Undo, this, SLOT(undo()));
accel->connectItem(KStdAccel::Redo, this, SLOT(redo()));
accel->connectItem(KStdAccel::Print, this, SLOT(print()));
accel->connectItem(KStdAccel::Save, this, SLOT(save_all()));
accel->connectItem(KStdAccel::Close, this, SLOT(hideKPostit()));
accel->connectItem(KStdAccel::Quit, this, SLOT(quit()));
accel->connectItem(KStdAccel::Help, this, SLOT(help()));
}
knotes'KPostit::~KPostit() (./kdeutils/knotes/knotes.cpp:458)
KPostit::~KPostit( void )
{
delete mOptionDialog;
}
knotes'KPostit::clear_text() (./kdeutils/knotes/knotes.cpp:464)
void KPostit::clear_text( void )
{
edit->clear();
}
knotes'KPostit::selectFont() (./kdeutils/knotes/knotes.cpp:470)
void KPostit::selectFont( void )
{
QFont myfont = edit->font();
KFontDialog::getFont(myfont);
edit->setFont(myfont);
font = myfont;
}
knotes'KPostit::quit() (./kdeutils/knotes/knotes.cpp:478)
void KPostit::quit( void )
{
for( PostitList.first(); PostitList.current() != 0; PostitList.next() )
{
if(!PostitList.current()->savenotes())
{
QString msg = i18n(""
"Could not save a note.\n"
"Exit anyways?");
int result = KMessageBox::warningYesNo( this, msg );
if (result != KMessageBox::Yes )
{
return;
}
}
}
writeSettings();
if( savealarms() == false )
{
KMessageBox::sorry(this, i18n("Could not save Alarm(s)\n") );
}
QApplication::exit();
}
knotes'KPostit::help() (./kdeutils/knotes/knotes.cpp:504)
void KPostit::help( void )
{
kapp->invokeHTMLHelp("","");
}
knotes'KPostit::undo() (./kdeutils/knotes/knotes.cpp:510)
void KPostit::undo( void )
{
edit->undo();
}
knotes'KPostit::redo() (./kdeutils/knotes/knotes.cpp:516)
void KPostit::redo( void )
{
edit->redo();
}
knotes'KPostit::insertDate() (./kdeutils/knotes/knotes.cpp:522)
void KPostit::insertDate( void )
{
int line, column;
edit->getCursorPosition(&line,&column);
edit->insertAt( KGlobal::locale()->formatDateTime(QDateTime::currentDateTime()), line, column );
}
knotes'KPostit::mail() (./kdeutils/knotes/knotes.cpp:529)
void KPostit::mail( void )
{
Mail *mailDialog = new Mail( this,"maildialog");
if( mailDialog == 0 ) { return; }
if( mailDialog->exec() != QDialog::Accepted )
{
delete mailDialog;
return;
}
kapp->processEvents();
kapp->flushX();
QString cmd = postitdefaults.mailcommand.copy();
cmd = cmd.sprintf(postitdefaults.mailcommand.ascii(),
mailDialog->getSubject().ascii(),
mailDialog->getRecipient().ascii());
delete mailDialog;
FILE *mailpipe = popen( cmd.ascii(),"w" );
if(mailpipe == 0)
{
QString msg = i18n(""
"Could not pipe the contents of this KNote into:\n %1").arg(cmd);
KMessageBox::sorry(this, msg);
return;
}
QTextStream t( mailpipe, IO_WriteOnly );
int line_count = edit->numLines();
for(int i = 0 ; i < line_count ; i++)
{
t << edit->textLine(i) << '\n';
}
pclose(mailpipe);
}
knotes'KPostit::insertCalendar() (./kdeutils/knotes/knotes.cpp:569)
void KPostit::insertCalendar( void )
{
FILE *calfile = popen("cal","r");
QTextStream t(calfile,IO_ReadOnly );
while ( !t.eof() )
{
QString s = t.readLine();
edit->insertLine( s );
}
repaint();
// The calfile is closed by the QTextStream.
}
knotes'KPostit::setAlarm() (./kdeutils/knotes/knotes.cpp:583)
void KPostit::setAlarm( void )
{
AlarmDialog *alarmDialog = new AlarmDialog( this, "alarm" );
if( alarmDialog == 0 ) return;
if( alarmDialog->exec() == QDialog::Rejected )
{
delete alarmDialog;
return;
}
QDateTime dt = alarmDialog->getDateTime();
delete alarmDialog;
AlarmEntry *entry = new AlarmEntry;
entry->name = name.copy();
entry->dt = dt;
AlarmList.append(entry);
QString str = QString("%1 (A)").arg(name);
setCaption( i18n("Note: ") + str );
label->setText(str);
}
knotes'KPostit::save_all() (./kdeutils/knotes/knotes.cpp:607)
void KPostit::save_all( void )
{
for( KPostit::PostitList.first(); KPostit::PostitList.current() != 0;
KPostit::PostitList.next() )
{
KPostit::PostitList.current()->savenotes();
}
}
knotes'KPostit::print() (./kdeutils/knotes/knotes.cpp:616)
void KPostit::print(){
kapp->processEvents();
kapp->flushX();
FILE* printpipe;
QString cmd;
cmd = postitdefaults.printcommand.copy();
cmd = cmd.sprintf(postitdefaults.printcommand.ascii(),name.ascii());
// printf("%s\n",cmd.ascii());
printpipe = popen(cmd.ascii(),"w");
if(printpipe == 0 )
{
QString msg = i18n(""
"Could not pipe the contents of this KNote into:\n %1").arg(cmd);
KMessageBox::sorry(this, msg);
return;
}
QTextStream t(printpipe,IO_WriteOnly );
int line_count = edit->numLines();
for(int i = 0 ; i < line_count ; i++){
t << edit->textLine(i) << '\n';
}
pclose(printpipe);
}
knotes'KPostit::newKPostit() (./kdeutils/knotes/knotes.cpp:650)
void KPostit::newKPostit( void )
{
QString pname;
bool exists = false;
//
// lets give it the next available name of the for kpostit %d, with %d
// and integer. If we have more than fifty of those, we give up.
//
for(int i = 1; i < 50; i++)
{
exists = false;
pname = "";
pname = QString("knote %1").arg(i);
for( QStringList::Iterator it=PostitFilesList.begin();
it != PostitFilesList.end() && !exists; it++ )
{
if( *it==pname )
{
exists = true;
break;
}
}
if( exists == false )
{
break;
}
}
if( exists == true ) // all 50 names are taken
{
QString msg = i18n(""
"You have exeeded the arbitrary and unjustly set limit of 50 knotes.\n"
"Please complain to the author.");
KMessageBox::sorry(this,msg);
return;
}
//
// update all popup menus
//
for(PostitList.first();PostitList.current();PostitList.next())
{
//
// now remove and then reinsert, in a sorted fashion, the
// popup menu entries
//
for( uint i = 0 ; i < PostitFilesList.count();i++)
{
PostitList.current()->right_mouse_button->removeItemAt(0);
}
}
PostitFilesList.append(pname);
PostitFilesList.sort();
for(PostitList.first();PostitList.current();PostitList.next())
{
int k = 0;
for(QStringList::Iterator it=PostitFilesList.begin();
it != PostitFilesList.end(); it++)
{
PostitList.current()->right_mouse_button->insertItem(*it,k,k);
k++;
}
}
KPostit *t = new KPostit (NULL,NULL,PostitFilesList.count() - 1 ,pname);
t->show ();
PostitList.append( t );
docker->createLeftPopUp();
}
knotes'KPostit::RMBActivated() (./kdeutils/knotes/knotes.cpp:727)
void KPostit::RMBActivated(int i)
{
// convert absolute id to relative index
findKPostit(right_mouse_button->indexOf(i));
}
knotes'KPostit::findKPostit() (./kdeutils/knotes/knotes.cpp:733)
void KPostit::findKPostit(int i){
if ( i < 0)
return;
if ( i >= (int)PostitFilesList.count()){// this is not a kpostit file menue entry
// this should however already been caught
// by the above if (i < 0)
return;
}
// activate the correponding kpostit if a windget already exists for it
for(PostitList.first(); PostitList.current() ; PostitList.next()){
if (PostitList.current()->name == QString(right_mouse_button->text(
right_mouse_button->idAt( i)))) {
if( PostitList.current()->hidden == true){
PostitList.current()->hidden = false;
if(propertystring != (QString) "")
PostitList.current()->setGeometry(KWM::setProperties(PostitList.current()->winId(),
PostitList.current()->propertystring));
}
PostitList.current()->show();
KWM::activate(PostitList.current()->winId());
return;
}
}
KPostit *t = new KPostit (NULL,NULL,i,
right_mouse_button->text(
right_mouse_button->idAt(i)));
t->show ();
PostitList.append( t );
}
knotes'KPostit::renameKPostit() (./kdeutils/knotes/knotes.cpp:771)
void KPostit::renameKPostit(){
QString newName;
RenameDialog* dlg = new RenameDialog(this,"renamedlg",true,&newName,
&PostitFilesList);
if(dlg->exec()){
QString notesfile( locateLocal("appdata", "notes/"+name) );
QString newnotesfile( locateLocal("appdata", "notes/"+newName) );
if(rename(notesfile.ascii(),newnotesfile.ascii())){
}
/*for(PostitFilesList.first();PostitFilesList.current();PostitFilesList.next()){
if(name == QString(PostitFilesList.current())){
PostitFilesList.remove(PostitFilesList.at());*/
for(QStringList::Iterator it=PostitFilesList.begin();
it != PostitFilesList.end();it++)
{
if (name == *it)
{
PostitFilesList.remove(it);
break;
}
}
// update name in timer list if this postit was registered there
bool have_alarm = FALSE;
mytimer->stop();
for(KPostit::AlarmList.first();KPostit::AlarmList.current();
KPostit::AlarmList.next()){
if (KPostit::AlarmList.current()->name == name){
have_alarm = TRUE;
KPostit::AlarmList.current()->name = newName.copy();
}
}
mytimer->start();
PostitFilesList.append(newName);
PostitFilesList.sort();
name = newName;
if (have_alarm){
label->setText(name + " (A)");
setCaption(i18n("Note: ") + name + " (A)");
}
else {
label->setText(name);
setCaption(i18n("Note: ") + name);
}
// remove and reinsert the popup menues in a sorted fashion
for(PostitList.first();PostitList.current();PostitList.next())
{
for(uint i = 0 ; i < PostitFilesList.count();i++)
{
PostitList.current()->right_mouse_button->removeItemAt(0);
}
int k = 0;
for(QStringList::Iterator it=PostitFilesList.begin();
it != PostitFilesList.end(); it++)
{
PostitList.current()->right_mouse_button->insertItem(*it,k,k);
k++;
}
docker->createLeftPopUp();
}
}
delete dlg;
}
knotes'KPostit::hideKPostit() (./kdeutils/knotes/knotes.cpp:851)
void KPostit::hideKPostit(){
int numVisible = 0;
hidden = true;
propertystring = KWM::properties(winId());
this->hide();
for(PostitList.first(); PostitList.current() ; PostitList.next())
if(PostitList.current()->hidden == false)
numVisible++;
if ((numVisible == 0) && !dock)
// no more visible notes and not docked = no menu !
toggleDock();
}
knotes'KPostit::deleteKPostit() (./kdeutils/knotes/knotes.cpp:868)
void KPostit::deleteKPostit()
{
QString msg = i18n(""
"Are you sure you want to delete this\n"
"note permanently?");
int result = KMessageBox::warningYesNo( this, msg );
if( result != KMessageBox::Yes )
{
return;
}
QString notesfile( locateLocal("appdata", "notes/"+name) );
if( remove(notesfile.ascii()) )
{
}
for(PostitList.first();PostitList.current();PostitList.next())
{
// remove popup entries
for(uint i = 0 ; i < PostitFilesList.count();i++){
PostitList.current()->right_mouse_button->removeItemAt(0);
}
}
for(QStringList::Iterator it=PostitFilesList.begin();
it != PostitFilesList.end(); it++) {
if (name == *it) {
PostitFilesList.remove(it);
break;
}
}
if ((PostitFilesList.count()==0) && !dock)
// no more notes and non docked = no menu !
toggleDock();
// reinsert PostitFilesList into popus in a sorted fashion
for(PostitList.first();PostitList.current();PostitList.next())
{
int k = 0;
for(QStringList::Iterator it=PostitFilesList.begin();
it != PostitFilesList.end() ; it++)
{
PostitList.current()->right_mouse_button->insertItem(*it,k,k);
k++;
}
}
docker->createLeftPopUp();
mytimer->stop();
for(KPostit::AlarmList.first();KPostit::AlarmList.current();KPostit::AlarmList.next())
{
if (KPostit::AlarmList.current()->name == name)
{
delete KPostit::AlarmList.current();
KPostit::AlarmList.remove(KPostit::AlarmList.current());
}
}
mytimer->start();
PostitList.remove( this );
delete this;
}
knotes'KPostit::loadnotes() (./kdeutils/knotes/knotes.cpp:934)
bool KPostit::loadnotes()
{
QString notesfile ( locateLocal("appdata", "notes/"+name) );
QFile file(notesfile);
if( !file.open( IO_ReadOnly ))
return FALSE;
edit->setAutoUpdate(FALSE);
QTextStream t(&file);
// get the name
QString name = t.readLine();
// get the geomtery
QString geom = t.readLine();
propertystring = geom;
setGeometry(KWM::setProperties(winId(), geom));
// get the backcolor
QString red = t.readLine();
QString green = t.readLine();
QString blue = t.readLine();
backcolor.setRgb(red.toUInt(),green.toUInt(),blue.toUInt());
// get the forecolor
red = t.readLine();
green = t.readLine();
blue = t.readLine();
forecolor.setRgb(red.toUInt(),green.toUInt(),blue.toUInt());
// get the font
QString fontfamily = t.readLine();
int pointsize;
int weight;
bool italic = FALSE;
QString pointsizestr = t.readLine();
QString weightstr = t.readLine();
QString italicstr = t.readLine();
pointsize = pointsizestr.toUInt();
weight = weightstr.toUInt();
int italicint = italicstr.toUInt();
if(italicint == 1)
italic = TRUE;
else
italic = FALSE;
font = QFont(fontfamily,pointsize,weight,italic);
int int3d;
QString int3dstr = t.readLine();
int3d = int3dstr.toUInt();
if(int3d == 1)
frame3d = TRUE;
else
frame3d = FALSE;
int indent;
QString autostr = t.readLine();
indent = autostr.toUInt();
if(indent == 1)
edit->autoIndentMode = TRUE;
else
edit->autoIndentMode = FALSE;
QString hiddenstring = t.readLine();
int hiddenint = hiddenstring.toUInt();
if(hiddenint == 1)
hidden = true;
else
hidden = false;
// get the text body
while ( !t.eof() )
{
QString s = t.readLine();
// if(!t.eof())
edit->insertLine( s );
}
edit->setAutoUpdate(TRUE);
file.close();
return TRUE;
}
knotes'KPostit::insertFile() (./kdeutils/knotes/knotes.cpp:1035)
bool KPostit::insertFile(const QString &filename)
{
QFile file(filename);
if( !file.open( IO_ReadOnly ))
{
QString string;
string = i18n("Could not load:\n %1").arg(filename);
KMessageBox::sorry(this, string);
return FALSE;
}
edit->setAutoUpdate(FALSE);
QTextStream t(&file);
while ( !t.eof() )
{
QString s = t.readLine();
// if(!t.eof())
edit->insertLine( s );
}
edit->setAutoUpdate(TRUE);
file.close();
edit->repaint();
return TRUE;
}
knotes'KPostit::resizeEvent() (./kdeutils/knotes/knotes.cpp:1068)
void KPostit::resizeEvent( QResizeEvent * )
{
label->adjustSize();
label->setGeometry(1,1,width()-label->height()-2,label->height());
edit->setGeometry(1, label->height()+1, width()-2, height()-label->height()-2);
mybutton->setGeometry(this->width()-label->height()-1 ,1,label->height(),label->height());
}
knotes'KPostit::closeEvent() (./kdeutils/knotes/knotes.cpp:1076)
void KPostit::closeEvent( QCloseEvent * )
{
deleteKPostit();
};
knotes'KPostit::savenotes() (./kdeutils/knotes/knotes.cpp:1081)
bool KPostit::savenotes(){
QString notesfile( locateLocal("appdata", "notes/"+name) );
QFile file(notesfile);
if( !file.open( IO_WriteOnly)) {
return FALSE;
}
QTextStream t(&file);
t << name <<'\n';
if( this->hidden){
t << propertystring << '\n';
}
else{
t << KWM::properties(winId()) <<'\n';
}
t << backcolor.red() <<'\n';
t << backcolor.green()<< '\n';
t << backcolor.blue() <<'\n';
t << forecolor.red()<< '\n';
t << forecolor.green() <<'\n';
t << forecolor.blue()<< '\n';
t << font.family() <<'\n';
t << font.pointSize()<< '\n';
t << font.weight() <<'\n';
t << (font.italic() ? 1 : 0) << endl;
t << (frame3d ? 1 : 0) << endl;
t << (edit->autoIndentMode ? 1 : 0) << endl;
t << (hidden ? 1 : 0) << endl;
int line_count = edit->numLines();
for(int i = 0 ; i < line_count ; i++){
t << edit->textLine(i) << '\n';
}
file.close();
return TRUE;
}
knotes'KPostit::eventFilter() (./kdeutils/knotes/knotes.cpp:1132)
bool KPostit::eventFilter(QObject *o, QEvent *ev)
{
static QPoint tmp_point;
QMouseEvent *e = (QMouseEvent *)ev;
if( o == label )
{
if( ev->type() == QEvent::MouseButtonRelease )
{
if( e->button() == LeftButton )
{
dragging = false;
label->releaseMouse();
raise();
}
if (e->button() == MidButton)
lower();
return TRUE;
}
if( ev->type() == QEvent::MouseButtonPress && e->button() == LeftButton)
{
pointerOffset = e->pos();
label->grabMouse(sizeAllCursor);
return TRUE;
}
if( ev->type() == QEvent::MouseMove && label == mouseGrabber())
{
if (dragging)
{
move(QCursor::pos()-pointerOffset);
}
else
{
dragging = (
(e->pos().x() - pointerOffset.x())
*
(e->pos().x() - pointerOffset.x())
+
(e->pos().y() - pointerOffset.y())
*
(e->pos().y() - pointerOffset.y())
>= 9);
}
return TRUE;
}
if (ev->type() == QEvent::MouseMove)
return TRUE;
}
(void) o;
if(ev->type() != QEvent::MouseButtonPress)
return FALSE;
if(e->button() != RightButton)
return FALSE;
tmp_point = QCursor::pos();
if(right_mouse_button)
{
desktops->clear();
int i;
int n = KWin::numberOfDesktops();
printf("KWin::numberOfDesktops()=%d\n", KWin::numberOfDesktops() );
for (i=1; i <= n; i++)
{
QString b = "&";
//b.append(KWM::desktopName(i));
b.append(QString::number(i));
desktops->insertItem(b, i);
}
desktops->setItemChecked(KWin::currentDesktop(), TRUE);
/*
if (KWM::isSticky(winId()))
right_mouse_button->changeItem(KWM::unStickyString(), sticky_id);
else
right_mouse_button->changeItem(KWM::stickyString(), sticky_id);
*/
//right_mouse_button->popup(tmp_point);
}
return TRUE;
}
knotes'KPostit::set3DFrame() (./kdeutils/knotes/knotes.cpp:1223)
void KPostit::set3DFrame(bool enable)
{
frame3d = enable;
options->setItemChecked(frame3dID, enable);
long oldDeco = KWM::decoration(winId());
if (enable)
KWM::setDecoration(winId(),
oldDeco & ~KWM::noDecoration | KWM::tinyDecoration);
else
KWM::setDecoration(winId(),
oldDeco & ~KWM::tinyDecoration | KWM::noDecoration);
edit->repaint();
}
knotes'KPostit::toggleFrame() (./kdeutils/knotes/knotes.cpp:1241)
void KPostit::toggleFrame( void )
{
set3DFrame( !frame3d );
}
knotes'KPostit::toggleDock() (./kdeutils/knotes/knotes.cpp:1247)
void KPostit::toggleDock( void )
{
if( dock == true )
{
dock = false;
docker->undock();
}
else
{
dock = true;
docker->dock();
}
options->setItemChecked(dockID,dock);
}
knotes'KPostit::defaults() (./kdeutils/knotes/knotes.cpp:1263)
void KPostit::defaults( void )
{
if( mOptionDialog == 0 )
{
mOptionDialog = new OptionDialog( this, "option", false );
if( mOptionDialog == 0 ) return;
mOptionDialog->setState( postitdefaults );
connect( mOptionDialog, SIGNAL( valueChanged(const DefStruct &)),
this, SLOT(configurationChanged(const DefStruct &)));
}
mOptionDialog->show();
}
knotes'KPostit::configurationChanged() (./kdeutils/knotes/knotes.cpp:1277)
void KPostit::configurationChanged( const DefStruct &state )
{
bool onTop = postitdefaults.onTop;
postitdefaults = state;
postitdefaults.onTop = onTop;
}
knotes'KPostit::set_colors() (./kdeutils/knotes/knotes.cpp:1284)
void KPostit::set_colors()
{
QPalette mypalette = (edit->palette()).copy();
QColorGroup cgrp = mypalette.normal();
QColorGroup ncgrp(forecolor,cgrp.background(),
cgrp.light(),cgrp.dark(),cgrp.mid(),forecolor,backcolor);
mypalette.setNormal(ncgrp);
mypalette.setDisabled(ncgrp);
mypalette.setActive(ncgrp);
edit->setPalette(mypalette);
edit->setBackgroundColor(backcolor);
label->setPalette(mypalette);
label->setBackgroundColor(backcolor.dark(120));
mybutton->setPalette(mypalette);
mybutton->setBackgroundColor(backcolor.dark(120));
setBackgroundColor(backcolor.dark(150));
}
knotes'KPostit::set_foreground_color() (./kdeutils/knotes/knotes.cpp:1307)
void KPostit::set_foreground_color()
{
QColor color;
color = forecolor;
if(KColorDialog::getColor(color) != QDialog::Accepted)
return;
forecolor = color;
set_colors();
}
knotes'KPostit::set_background_color() (./kdeutils/knotes/knotes.cpp:1320)
void KPostit::set_background_color()
{
QColor color;
color = backcolor;
if( KColorDialog::getColor(color) != QDialog::Accepted)
return;
backcolor = color;
set_colors();
}
knotes'KPostit::insertNetFile() (./kdeutils/knotes/knotes.cpp:1335)
void KPostit::insertNetFile( const char *_url)
{
QString string;
QString netFile = _url;
debug("KPostit::insertNetfile()");
KURL u( netFile );
if ( u.isMalformed() )
{
KMessageBox::sorry(
this,
i18n("Malformed URL"));
return;
}
// Just a usual file ?
if ( u.protocol() == "file" )
{
insertFile( u.path() );
return;
}
if (KIO::NetAccess::download( netFile, tmpFile ))
{
insertFile( tmpFile );
KIO::NetAccess::removeTempFile( tmpFile );
}
}
knotes'KPostit::close() (./kdeutils/knotes/knotes.cpp:1369)
void KPostit::close( void )
{
if( savenotes() == false )
{
QString msg = i18n(""
"Could not save the notes.\n"
"Close anyways?");
int result = KMessageBox::warningYesNo( this, msg );
if( result != KMessageBox::Yes )
{
return;
}
}
if ( PostitList.count() > 1 )
{
PostitList.remove( this );
delete this;
}
else
{
quit();
}
}
knotes'KPostit::toggleIndentMode() (./kdeutils/knotes/knotes.cpp:1395)
void KPostit::toggleIndentMode()
{
if(edit->autoIndentMode)
setNoAutoIndent();
else
setAutoIndent();
}
knotes'KPostit::toDesktop() (./kdeutils/knotes/knotes.cpp:1403)
void KPostit::toDesktop(int d)
{
KWM::moveToDesktop(winId(), d);
}
knotes'KPostit::toggleSticky() (./kdeutils/knotes/knotes.cpp:1408)
void KPostit::toggleSticky()
{
KWM::setSticky(winId(), !KWM::isSticky(winId()));
}
knotes'KPostit::setAutoIndent() (./kdeutils/knotes/knotes.cpp:1413)
void KPostit::setAutoIndent()
{
edit->autoIndentMode = TRUE;
options->setItemChecked(edit->autoIndentID,TRUE);
}
knotes'KPostit::setNoAutoIndent() (./kdeutils/knotes/knotes.cpp:1419)
void KPostit::setNoAutoIndent()
{
edit->autoIndentMode = FALSE;
options->setItemChecked(edit->autoIndentID,FALSE);
}
knotes'KPostit::setOnTop() (./kdeutils/knotes/knotes.cpp:1425)
void KPostit::setOnTop(bool enable)
{
long oldDeco = KWM::decoration(winId());
if (enable)
KWM::setDecoration(winId(),oldDeco | KWM::staysOnTop);
else
KWM::setDecoration(winId(), oldDeco & ~KWM::staysOnTop);
options->setItemChecked(onTopID, enable);
postitdefaults.onTop = enable;
}
knotes'KPostit::toggleOnTopMode() (./kdeutils/knotes/knotes.cpp:1438)
void KPostit::toggleOnTopMode()
{
setOnTop(!postitdefaults.onTop);
}