File: mail.cpp

package info (click to toggle)
kdeutils 2%3A980312-6
  • links: PTS
  • area: contrib
  • in suites: hamm
  • size: 5,380 kB
  • ctags: 3,423
  • sloc: cpp: 17,658; ansic: 9,867; sh: 6,347; makefile: 2,060; awk: 378; sed: 111; perl: 108
file content (98 lines) | stat: -rw-r--r-- 2,329 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98

/*

 $Id: mail.cpp,v 1.2 1997/11/23 07:45:24 wuebben Exp $

 KNotes -- Notes for the KDE project

 Copyright (C) Bernd Johannes Wuebben
               wuebben@math.cornell.edu
	       wuebben@kde.org

 This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License
 as published by the Free Software Foundation; either version 2
 of the License, or (at your option) any later version.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

 */


#include "mail.h"


Mail::Mail(KPostit *parent, const char *name)
    : QDialog(parent, name,TRUE){


    this->setFocusPolicy(QWidget::StrongFocus);

    frame1 = new QGroupBox("Mail Note to::", this, "frame1");

    recipient = new QLineEdit( this, "recipient");
    recipient->setFocus();

    subject = new QLineEdit( this, "subject");
    subject->setText(parent->name);

    subjectlabel = new QLabel(this,"subjectlabel");
    subjectlabel->setText("Subject:");

    ok = new QPushButton("Mail", this, "mail");
    connect(ok, SIGNAL(clicked()), this, SLOT(ok_slot()));

    cancel = new QPushButton("Cancel", this, "cancel");
    connect(cancel, SIGNAL(clicked()), this, SLOT(cancel_slot()));

    setFixedSize(330, 160);

}

void Mail::resizeEvent(QResizeEvent *){

    frame1->setGeometry(5, 5, width() - 10, 115);

    cancel->setGeometry(width() - 80, height() - 30, 70, 25);
    ok->setGeometry(width() - 80 - 80 - 10, height() - 30, 70, 25);

    recipient->setGeometry(20, 25, width() - 40, 25);
    subject->setGeometry(20, 80, width() - 40, 25);
    
    subjectlabel->setGeometry(20,55,80,20);
}


void Mail::focusInEvent( QFocusEvent *){

    recipient->setFocus();

}

void Mail::cancel_slot(){
  reject();
}

void Mail::ok_slot(){

  QString str = getRecipient();
  if (str.isEmpty()){
    QMessageBox::warning(
			 this,
			 "Sorry",
			 "You must specify a Recipient"
			 );
    return;
  }

  accept();
}

#include "mail.moc"