author | leseb <leseb> | 2002-06-16 15:34:57 (UTC) |
---|---|---|
committer | leseb <leseb> | 2002-06-16 15:34:57 (UTC) |
commit | 1b74249e80cf9f33e52fdb7cc96a114e8be85bc1 (patch) (unidiff) | |
tree | 679a1a47c9843e8f89dbe0b3bad532ae60187d72 | |
parent | 4c1300773b986ad5725492cd26743d542ed16311 (diff) | |
download | opie-1b74249e80cf9f33e52fdb7cc96a114e8be85bc1.zip opie-1b74249e80cf9f33e52fdb7cc96a114e8be85bc1.tar.gz opie-1b74249e80cf9f33e52fdb7cc96a114e8be85bc1.tar.bz2 |
Fix memory leaks
-rw-r--r-- | noncore/unsupported/mail2/addresspicker.cpp | 10 | ||||
-rw-r--r-- | noncore/unsupported/mail2/attachdiag.cpp | 10 | ||||
-rw-r--r-- | noncore/unsupported/mail2/configdiag.cpp | 21 | ||||
-rw-r--r-- | noncore/unsupported/mail2/rename.cpp | 28 |
4 files changed, 35 insertions, 34 deletions
diff --git a/noncore/unsupported/mail2/addresspicker.cpp b/noncore/unsupported/mail2/addresspicker.cpp index 178fe27..7f32725 100644 --- a/noncore/unsupported/mail2/addresspicker.cpp +++ b/noncore/unsupported/mail2/addresspicker.cpp | |||
@@ -43,75 +43,75 @@ AddressPicker::AddressPicker(QWidget *parent, const char *name, bool modal, | |||
43 | } | 43 | } |
44 | pos = (*it).find("LastName=\""); | 44 | pos = (*it).find("LastName=\""); |
45 | QString lname; | 45 | QString lname; |
46 | if (pos != -1) { | 46 | if (pos != -1) { |
47 | int i = 1; | 47 | int i = 1; |
48 | QChar c; | 48 | QChar c; |
49 | while (c != '"') { | 49 | while (c != '"') { |
50 | c = (*it)[pos + 9 + i]; | 50 | c = (*it)[pos + 9 + i]; |
51 | if (c != '"') lname += c; | 51 | if (c != '"') lname += c; |
52 | i++; | 52 | i++; |
53 | } | 53 | } |
54 | } | 54 | } |
55 | pos = (*it).find("DefaultEmail=\""); | 55 | pos = (*it).find("DefaultEmail=\""); |
56 | QString email; | 56 | QString email; |
57 | if (pos != -1) { | 57 | if (pos != -1) { |
58 | int i = 1; | 58 | int i = 1; |
59 | QChar c; | 59 | QChar c; |
60 | while (c != '"') { | 60 | while (c != '"') { |
61 | c = (*it)[pos + 13 + i]; | 61 | c = (*it)[pos + 13 + i]; |
62 | if (c != '"') email += c; | 62 | if (c != '"') email += c; |
63 | i++; | 63 | i++; |
64 | } | 64 | } |
65 | } | 65 | } |
66 | QString tname, temail; | 66 | QString tname, temail; |
67 | if (!fname.isEmpty()) tname += fname; | 67 | if (!fname.isEmpty()) tname += fname; |
68 | if (!lname.isEmpty()) tname += fname.isEmpty() ? lname : (" " + lname); | 68 | if (!lname.isEmpty()) tname += fname.isEmpty() ? lname : (" " + lname); |
69 | if (!email.isEmpty()) temail += tname.isEmpty() ? email : (" <" + email + ">"); | 69 | if (!email.isEmpty()) temail += tname.isEmpty() ? email : (" <" + email + ">"); |
70 | if (!email.isEmpty()) addressList->insertItem(tname + temail); | 70 | if (!email.isEmpty()) addressList->insertItem(tname + temail); |
71 | } | 71 | } |
72 | } | 72 | } |
73 | } | 73 | } |
74 | if (addressList->count() <= 0) { | 74 | if (addressList->count() <= 0) { |
75 | addressList->insertItem(tr("There are no entries in the addressbook.")); | 75 | addressList->insertItem(tr("There are no entries in the addressbook.")); |
76 | addressList->setEnabled(false); | 76 | addressList->setEnabled(false); |
77 | okButton->setEnabled(false); | 77 | okButton->setEnabled(false); |
78 | } | 78 | } |
79 | } | 79 | } |
80 | 80 | ||
81 | void AddressPicker::accept() | 81 | void AddressPicker::accept() |
82 | { | 82 | { |
83 | QListBoxItem *item = addressList->firstItem(); | 83 | QListBoxItem *item = addressList->firstItem(); |
84 | QString names; | 84 | QString names; |
85 | 85 | ||
86 | while (item) { | 86 | while (item) { |
87 | if (item->selected()) | 87 | if (item->selected()) |
88 | names += item->text() + ", "; | 88 | names += item->text() + ", "; |
89 | item = item->next(); | 89 | item = item->next(); |
90 | } | 90 | } |
91 | names.replace(names.length() - 2, 2, ""); | 91 | names.replace(names.length() - 2, 2, ""); |
92 | 92 | ||
93 | if (names.isEmpty()) { | 93 | if (names.isEmpty()) { |
94 | QMessageBox::information(this, tr("Error"), tr("<p>You have to select" | 94 | QMessageBox::information(this, tr("Error"), tr("<p>You have to select" |
95 | " at least one address entry.</p>"), tr("Ok")); | 95 | " at least one address entry.</p>"), tr("Ok")); |
96 | return; | 96 | return; |
97 | } | 97 | } |
98 | 98 | ||
99 | selectedNames = names; | 99 | selectedNames = names; |
100 | QDialog::accept(); | 100 | QDialog::accept(); |
101 | } | 101 | } |
102 | 102 | ||
103 | QString AddressPicker::getNames() | 103 | QString AddressPicker::getNames() |
104 | { | 104 | { |
105 | QString names = 0; | 105 | QString names = 0; |
106 | 106 | ||
107 | AddressPicker *picker = new AddressPicker(0, 0, true); | 107 | AddressPicker picker(0, 0, true); |
108 | picker->showMaximized(); | 108 | picker.showMaximized(); |
109 | picker->show(); | 109 | picker.show(); |
110 | 110 | ||
111 | int ret = picker->exec(); | 111 | int ret = picker.exec(); |
112 | if (QDialog::Accepted == ret) { | 112 | if (QDialog::Accepted == ret) { |
113 | return picker->selectedNames; | 113 | return picker.selectedNames; |
114 | } | 114 | } |
115 | return 0; | 115 | return 0; |
116 | } | 116 | } |
117 | 117 | ||
diff --git a/noncore/unsupported/mail2/attachdiag.cpp b/noncore/unsupported/mail2/attachdiag.cpp index bedf3c4..36e1948 100644 --- a/noncore/unsupported/mail2/attachdiag.cpp +++ b/noncore/unsupported/mail2/attachdiag.cpp | |||
@@ -1,71 +1,71 @@ | |||
1 | #include <qmessagebox.h> | 1 | #include <qmessagebox.h> |
2 | #include <qpushbutton.h> | 2 | #include <qpushbutton.h> |
3 | #include <qlistbox.h> | 3 | #include <qlistbox.h> |
4 | #include <qlayout.h> | 4 | #include <qlayout.h> |
5 | 5 | ||
6 | #include <qpe/fileselector.h> | 6 | #include <qpe/fileselector.h> |
7 | #include <qpe/resource.h> | 7 | #include <qpe/resource.h> |
8 | 8 | ||
9 | #include <stdlib.h> | 9 | #include <stdlib.h> |
10 | 10 | ||
11 | #include "attachdiag.h" | 11 | #include "attachdiag.h" |
12 | 12 | ||
13 | AttachDiag::AttachDiag(QWidget* parent = 0, const char* name = 0, bool modal, WFlags fl = 0) | 13 | AttachDiag::AttachDiag(QWidget* parent = 0, const char* name = 0, bool modal, WFlags fl = 0) |
14 | : QDialog(parent, name, modal, fl) | 14 | : QDialog(parent, name, modal, fl) |
15 | { | 15 | { |
16 | setCaption(tr("Attach File")); | 16 | setCaption(tr("Attach File")); |
17 | 17 | ||
18 | QGridLayout *layout = new QGridLayout(this); | 18 | QGridLayout *layout = new QGridLayout(this); |
19 | layout->setSpacing(3); | 19 | layout->setSpacing(3); |
20 | layout->setMargin(4); | 20 | layout->setMargin(4); |
21 | 21 | ||
22 | FileSelector *fileSelector = new FileSelector("*", this, "FileSelector"); | 22 | FileSelector *fileSelector = new FileSelector("*", this, "FileSelector"); |
23 | fileSelector->setCloseVisible(false); | 23 | fileSelector->setCloseVisible(false); |
24 | fileSelector->setNewVisible(false); | 24 | fileSelector->setNewVisible(false); |
25 | 25 | ||
26 | layout->addMultiCellWidget(fileSelector, 0, 0, 0, 1); | 26 | layout->addMultiCellWidget(fileSelector, 0, 0, 0, 1); |
27 | 27 | ||
28 | QPushButton *attachButton = new QPushButton(this); | 28 | QPushButton *attachButton = new QPushButton(this); |
29 | attachButton->setText(tr("Ok")); | 29 | attachButton->setText(tr("Ok")); |
30 | attachButton->setIconSet(Resource::loadPixmap("enter")); | 30 | attachButton->setIconSet(Resource::loadPixmap("enter")); |
31 | 31 | ||
32 | layout->addWidget(attachButton, 1, 0); | 32 | layout->addWidget(attachButton, 1, 0); |
33 | 33 | ||
34 | QPushButton *cancelButton = new QPushButton(this); | 34 | QPushButton *cancelButton = new QPushButton(this); |
35 | cancelButton->setText(tr("Cancel")); | 35 | cancelButton->setText(tr("Cancel")); |
36 | cancelButton->setIconSet(Resource::loadPixmap("editdelete")); | 36 | cancelButton->setIconSet(Resource::loadPixmap("editdelete")); |
37 | 37 | ||
38 | layout->addWidget(cancelButton, 1, 1); | 38 | layout->addWidget(cancelButton, 1, 1); |
39 | 39 | ||
40 | connect(fileSelector, SIGNAL(fileSelected(const DocLnk &)), SLOT(fileSelected(const DocLnk &))); | 40 | connect(fileSelector, SIGNAL(fileSelected(const DocLnk &)), SLOT(fileSelected(const DocLnk &))); |
41 | connect(attachButton, SIGNAL(clicked()), SLOT(accept())); | 41 | connect(attachButton, SIGNAL(clicked()), SLOT(accept())); |
42 | connect(cancelButton, SIGNAL(clicked()), SLOT(close())); | 42 | connect(cancelButton, SIGNAL(clicked()), SLOT(close())); |
43 | 43 | ||
44 | if (fileSelector->selected() != NULL) | 44 | if (fileSelector->selected() != NULL) |
45 | currentFile = *fileSelector->selected(); | 45 | currentFile = *fileSelector->selected(); |
46 | 46 | ||
47 | if (fileSelector->fileCount() == 0) { | 47 | if (fileSelector->fileCount() == 0) { |
48 | attachButton->setEnabled(false); | 48 | attachButton->setEnabled(false); |
49 | fileSelector->setEnabled(false); | 49 | fileSelector->setEnabled(false); |
50 | } | 50 | } |
51 | } | 51 | } |
52 | 52 | ||
53 | void AttachDiag::fileSelected(const DocLnk &file) | 53 | void AttachDiag::fileSelected(const DocLnk &file) |
54 | { | 54 | { |
55 | currentFile = file; | 55 | currentFile = file; |
56 | } | 56 | } |
57 | 57 | ||
58 | DocLnk AttachDiag::getFile(QWidget *parent) | 58 | DocLnk AttachDiag::getFile(QWidget *parent) |
59 | { | 59 | { |
60 | AttachDiag *attach = new AttachDiag(parent, 0, true); | 60 | AttachDiag attach(parent, 0, true); |
61 | attach->showMaximized(); | 61 | attach.showMaximized(); |
62 | attach->show(); | 62 | attach.show(); |
63 | 63 | ||
64 | if (QDialog::Accepted == attach->exec()) { | 64 | if (QDialog::Accepted == attach.exec()) { |
65 | return attach->currentFile; | 65 | return attach.currentFile; |
66 | } | 66 | } |
67 | 67 | ||
68 | return DocLnk(); | 68 | return DocLnk(); |
69 | } | 69 | } |
70 | 70 | ||
71 | 71 | ||
diff --git a/noncore/unsupported/mail2/configdiag.cpp b/noncore/unsupported/mail2/configdiag.cpp index be1f1f4..b89b937 100644 --- a/noncore/unsupported/mail2/configdiag.cpp +++ b/noncore/unsupported/mail2/configdiag.cpp | |||
@@ -18,127 +18,128 @@ | |||
18 | 18 | ||
19 | AccountListItem::AccountListItem(QListView *parent, Account &account) | 19 | AccountListItem::AccountListItem(QListView *parent, Account &account) |
20 | : QListViewItem(parent), _account(account) | 20 | : QListViewItem(parent), _account(account) |
21 | { | 21 | { |
22 | QString displayText; | 22 | QString displayText; |
23 | if (!_account.realName().isEmpty() && !_account.email().isEmpty()) | 23 | if (!_account.realName().isEmpty() && !_account.email().isEmpty()) |
24 | setText(0, _account.realName() + " <" + _account.email() + ">"); | 24 | setText(0, _account.realName() + " <" + _account.email() + ">"); |
25 | else if (_account.realName().isEmpty() && !_account.email().isEmpty()) | 25 | else if (_account.realName().isEmpty() && !_account.email().isEmpty()) |
26 | setText(0, _account.email()); | 26 | setText(0, _account.email()); |
27 | else if (!_account.realName().isEmpty() && _account.email().isEmpty()) | 27 | else if (!_account.realName().isEmpty() && _account.email().isEmpty()) |
28 | setText(0, _account.realName()); | 28 | setText(0, _account.realName()); |
29 | else | 29 | else |
30 | setText(0, QObject::tr("(no name)")); | 30 | setText(0, QObject::tr("(no name)")); |
31 | 31 | ||
32 | setPixmap(0, Resource::loadPixmap("mail/inbox")); | 32 | setPixmap(0, Resource::loadPixmap("mail/inbox")); |
33 | } | 33 | } |
34 | 34 | ||
35 | ConfigDiag::ConfigDiag(QWidget *parent, const char *name, bool modal, WFlags fl) | 35 | ConfigDiag::ConfigDiag(QWidget *parent, const char *name, bool modal, WFlags fl) |
36 | : ConfigDiagBase(parent, name, modal, fl) | 36 | : ConfigDiagBase(parent, name, modal, fl) |
37 | { | 37 | { |
38 | _configBenD = new Config("mail"); | 38 | _configBenD = new Config("mail"); |
39 | _configBenD->setGroup("Settings"); | 39 | _configBenD->setGroup("Settings"); |
40 | disabled->setChecked(_configBenD->readBoolEntry("Disabled", false)); | 40 | disabled->setChecked(_configBenD->readBoolEntry("Disabled", false)); |
41 | playSound->setChecked(_configBenD->readBoolEntry("PlaySound", false)); | 41 | playSound->setChecked(_configBenD->readBoolEntry("PlaySound", false)); |
42 | blinkLed->setChecked(_configBenD->readBoolEntry("BlinkLed", true)); | 42 | blinkLed->setChecked(_configBenD->readBoolEntry("BlinkLed", true)); |
43 | checkDelay->setValue(_configBenD->readNumEntry("CheckDelay", 5)); | 43 | checkDelay->setValue(_configBenD->readNumEntry("CheckDelay", 5)); |
44 | 44 | ||
45 | accountList->header()->hide(); | 45 | accountList->header()->hide(); |
46 | disclaimer->setText(disclaimer->text().arg(VERSION)); | 46 | disclaimer->setText(disclaimer->text().arg(VERSION)); |
47 | 47 | ||
48 | connect(accountNew, SIGNAL(clicked()), SLOT(slotNewAccount())); | 48 | connect(accountNew, SIGNAL(clicked()), SLOT(slotNewAccount())); |
49 | connect(accountEdit, SIGNAL(clicked()), SLOT(slotEditAccount())); | 49 | connect(accountEdit, SIGNAL(clicked()), SLOT(slotEditAccount())); |
50 | connect(accountDelete, SIGNAL(clicked()), SLOT(slotDelAccount())); | 50 | connect(accountDelete, SIGNAL(clicked()), SLOT(slotDelAccount())); |
51 | 51 | ||
52 | connect(testbutton, SIGNAL(clicked()), SLOT(slotTestSettings())); | 52 | connect(testbutton, SIGNAL(clicked()), SLOT(slotTestSettings())); |
53 | 53 | ||
54 | slotFillLists(); | 54 | slotFillLists(); |
55 | } | 55 | } |
56 | 56 | ||
57 | void ConfigDiag::accept() | 57 | void ConfigDiag::accept() |
58 | { | 58 | { |
59 | _configBenD->setGroup("Settings"); | 59 | _configBenD->setGroup("Settings"); |
60 | _configBenD->writeEntry("Disabled", disabled->isChecked()); | 60 | _configBenD->writeEntry("Disabled", disabled->isChecked()); |
61 | _configBenD->writeEntry("PlaySound", playSound->isChecked()); | 61 | _configBenD->writeEntry("PlaySound", playSound->isChecked()); |
62 | _configBenD->writeEntry("BlinkLed", blinkLed->isChecked()); | 62 | _configBenD->writeEntry("BlinkLed", blinkLed->isChecked()); |
63 | _configBenD->writeEntry("CheckDelay", checkDelay->value()); | 63 | _configBenD->writeEntry("CheckDelay", checkDelay->value()); |
64 | _configBenD->write(); | 64 | _configBenD->write(); |
65 | 65 | ||
66 | QDialog::accept(); | 66 | QDialog::accept(); |
67 | } | 67 | } |
68 | 68 | ||
69 | void ConfigDiag::slotFillLists() | 69 | void ConfigDiag::slotFillLists() |
70 | { | 70 | { |
71 | accountList->clear(); | 71 | accountList->clear(); |
72 | 72 | ||
73 | QValueList<Account> accounts = ConfigFile::getAccounts(); | 73 | QValueList<Account> accounts = ConfigFile::getAccounts(); |
74 | 74 | ||
75 | QValueList<Account>::Iterator it; | 75 | QValueList<Account>::Iterator it; |
76 | for (it = accounts.begin(); it != accounts.end(); it++) | 76 | for (it = accounts.begin(); it != accounts.end(); it++) |
77 | (void) new AccountListItem(accountList, *it); | 77 | (void) new AccountListItem(accountList, *it); |
78 | } | 78 | } |
79 | 79 | ||
80 | void ConfigDiag::slotNewAccount() | 80 | void ConfigDiag::slotNewAccount() |
81 | { | 81 | { |
82 | AccountEditor *editor = new AccountEditor(Account(), 0, 0, true); | 82 | Account account; |
83 | editor->showMaximized(); | 83 | AccountEditor editor(account, 0, 0, true); |
84 | editor->show(); | 84 | editor.showMaximized(); |
85 | editor.show(); | ||
85 | 86 | ||
86 | if (QDialog::Accepted == editor->exec()) { | 87 | if (QDialog::Accepted == editor.exec()) { |
87 | ConfigFile::updateAccount(editor->_account); | 88 | ConfigFile::updateAccount(editor._account); |
88 | slotFillLists(); | 89 | slotFillLists(); |
89 | emit changed(); | 90 | emit changed(); |
90 | } | 91 | } |
91 | } | 92 | } |
92 | 93 | ||
93 | void ConfigDiag::slotEditAccount() | 94 | void ConfigDiag::slotEditAccount() |
94 | { | 95 | { |
95 | if (!accountList->currentItem()) { | 96 | if (!accountList->currentItem()) { |
96 | QMessageBox::information(this, tr("Error"), tr("<p>You have to select an account first.</p>"), tr("Ok")); | 97 | QMessageBox::information(this, tr("Error"), tr("<p>You have to select an account first.</p>"), tr("Ok")); |
97 | return; | 98 | return; |
98 | } | 99 | } |
99 | Account account = ((AccountListItem *)accountList->currentItem())->account(); | 100 | Account account = ((AccountListItem *)accountList->currentItem())->account(); |
100 | 101 | ||
101 | AccountEditor *editor = new AccountEditor(account, 0, 0, true); | 102 | AccountEditor editor(account, 0, 0, true); |
102 | editor->showMaximized(); | 103 | editor.showMaximized(); |
103 | editor->show(); | 104 | editor.show(); |
104 | 105 | ||
105 | if (QDialog::Accepted == editor->exec()) { | 106 | if (QDialog::Accepted == editor.exec()) { |
106 | ConfigFile::updateAccount(editor->_account); | 107 | ConfigFile::updateAccount(editor._account); |
107 | slotFillLists(); | 108 | slotFillLists(); |
108 | emit changed(); | 109 | emit changed(); |
109 | } | 110 | } |
110 | } | 111 | } |
111 | 112 | ||
112 | void ConfigDiag::slotDelAccount() | 113 | void ConfigDiag::slotDelAccount() |
113 | { | 114 | { |
114 | if (!accountList->currentItem()) { | 115 | if (!accountList->currentItem()) { |
115 | QMessageBox::information(this, tr("Error"), tr("<p>You have to select an account first.</p>"), tr("Ok")); | 116 | QMessageBox::information(this, tr("Error"), tr("<p>You have to select an account first.</p>"), tr("Ok")); |
116 | return; | 117 | return; |
117 | } | 118 | } |
118 | Account account = ((AccountListItem *)accountList->currentItem())->account(); | 119 | Account account = ((AccountListItem *)accountList->currentItem())->account(); |
119 | 120 | ||
120 | int ret = QMessageBox::information(this, tr("Question"), tr("<p>Do you relly want to delete the selected account?</p>"), tr("Yes"), tr("No")); | 121 | int ret = QMessageBox::information(this, tr("Question"), tr("<p>Do you relly want to delete the selected account?</p>"), tr("Yes"), tr("No")); |
121 | if (1 == ret) return; | 122 | if (1 == ret) return; |
122 | 123 | ||
123 | ConfigFile::deleteAccount(account); | 124 | ConfigFile::deleteAccount(account); |
124 | slotFillLists(); | 125 | slotFillLists(); |
125 | emit changed(); | 126 | emit changed(); |
126 | } | 127 | } |
127 | 128 | ||
128 | void ConfigDiag::slotTestSettings() | 129 | void ConfigDiag::slotTestSettings() |
129 | { | 130 | { |
130 | testbutton->setEnabled(false); | 131 | testbutton->setEnabled(false); |
131 | 132 | ||
132 | if (blinkLed->isChecked()) ZaurusStuff::blinkLedOn(); | 133 | if (blinkLed->isChecked()) ZaurusStuff::blinkLedOn(); |
133 | if (playSound->isChecked()) ZaurusStuff::buzzerOn(); | 134 | if (playSound->isChecked()) ZaurusStuff::buzzerOn(); |
134 | QTimer::singleShot(3000, this, SLOT(slotEndTest())); | 135 | QTimer::singleShot(3000, this, SLOT(slotEndTest())); |
135 | } | 136 | } |
136 | 137 | ||
137 | void ConfigDiag::slotEndTest() | 138 | void ConfigDiag::slotEndTest() |
138 | { | 139 | { |
139 | if (playSound->isChecked()) ZaurusStuff::buzzerOff(); | 140 | if (playSound->isChecked()) ZaurusStuff::buzzerOff(); |
140 | if (blinkLed->isChecked()) ZaurusStuff::blinkLedOff(); | 141 | if (blinkLed->isChecked()) ZaurusStuff::blinkLedOff(); |
141 | 142 | ||
142 | testbutton->setEnabled(true); | 143 | testbutton->setEnabled(true); |
143 | } | 144 | } |
144 | 145 | ||
diff --git a/noncore/unsupported/mail2/rename.cpp b/noncore/unsupported/mail2/rename.cpp index 8c2fde1..627db0b 100644 --- a/noncore/unsupported/mail2/rename.cpp +++ b/noncore/unsupported/mail2/rename.cpp | |||
@@ -1,39 +1,39 @@ | |||
1 | #include <qlineedit.h> | 1 | #include <qlineedit.h> |
2 | #include <qlabel.h> | 2 | #include <qlabel.h> |
3 | 3 | ||
4 | #include "rename.h" | 4 | #include "rename.h" |
5 | 5 | ||
6 | Rename::Rename(QWidget *parent, const char *name, bool modal, WFlags fl) | 6 | Rename::Rename(QWidget *parent, const char *name, bool modal, WFlags fl) |
7 | : RenameBase(parent, name, modal, fl) | 7 | : RenameBase(parent, name, modal, fl) |
8 | { | 8 | { |
9 | } | 9 | } |
10 | 10 | ||
11 | QString Rename::rename(const QString &on, QWidget *parent) | 11 | QString Rename::rename(const QString &on, QWidget *parent) |
12 | { | 12 | { |
13 | Rename *rename = new Rename(parent, 0, true); | 13 | Rename rename(parent, 0, true); |
14 | rename->oldName->setText(on); | 14 | rename.oldName->setText(on); |
15 | rename->newName->setText(on); | 15 | rename.newName->setText(on); |
16 | rename->newName->setFocus(); | 16 | rename.newName->setFocus(); |
17 | 17 | ||
18 | if (rename->exec() == QDialog::Accepted) { | 18 | if (rename.exec() == QDialog::Accepted) { |
19 | return rename->newName->text(); | 19 | return rename.newName->text(); |
20 | } | 20 | } |
21 | 21 | ||
22 | return QString(0); | 22 | return QString(0); |
23 | } | 23 | } |
24 | 24 | ||
25 | QString Rename::getText(const QString &caption, const QString &secondLabel, QWidget *parent) | 25 | QString Rename::getText(const QString &caption, const QString &secondLabel, QWidget *parent) |
26 | { | 26 | { |
27 | Rename *rename = new Rename(parent, 0, true); | 27 | Rename rename(parent, 0, true); |
28 | rename->firstLabel->hide(); | 28 | rename.firstLabel->hide(); |
29 | rename->oldName->hide(); | 29 | rename.oldName->hide(); |
30 | rename->setCaption(caption); | 30 | rename.setCaption(caption); |
31 | rename->secondLabel->setText(secondLabel); | 31 | rename.secondLabel->setText(secondLabel); |
32 | 32 | ||
33 | if (rename->exec() == QDialog::Accepted) { | 33 | if (rename.exec() == QDialog::Accepted) { |
34 | return rename->newName->text(); | 34 | return rename.newName->text(); |
35 | } | 35 | } |
36 | 36 | ||
37 | return QString(0); | 37 | return QString(0); |
38 | } | 38 | } |
39 | 39 | ||