mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-26 11:16:55 +00:00
small fixes
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1234 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
69e5a077ea
commit
5d196310e5
@ -1,3 +1,9 @@
|
||||
2000-11-22 Lars Gullik Bjønnes <larsbj@lyx.org>
|
||||
|
||||
* configure.in (AC_OUTPUT): don't output src/xtl/Makefile
|
||||
|
||||
* src/lyx_sendfax.[Ch] src/lyx_sendfax_main.C: delete files
|
||||
|
||||
2000-11-22 Lars Gullik Bjønnes <larsbj@lyx.org>
|
||||
|
||||
* src/version.h: set back to 1.1.6cvs
|
||||
|
@ -291,7 +291,6 @@ AC_OUTPUT([Makefile \
|
||||
src/graphics/Makefile \
|
||||
src/insets/Makefile \
|
||||
src/support/Makefile \
|
||||
src/xtl/Makefile \
|
||||
src/frontends/Makefile \
|
||||
src/frontends/support/Makefile \
|
||||
src/frontends/xforms/Makefile \
|
||||
|
@ -124,8 +124,6 @@ src/lyx_gui.C
|
||||
src/lyx_gui_misc.C
|
||||
src/lyx_main.C
|
||||
src/lyxrc.C
|
||||
src/lyx_sendfax.C
|
||||
src/lyx_sendfax_main.C
|
||||
src/LyXSendto.C
|
||||
src/lyxvc.C
|
||||
src/LyXView.C
|
||||
|
@ -1,119 +0,0 @@
|
||||
// File modified by fdfix.sh for use by lyx (with xforms > 0.88) and gettext
|
||||
#include <config.h>
|
||||
#include "lyx_gui_misc.h"
|
||||
#include "gettext.h"
|
||||
|
||||
/* Form definition file generated with fdesign. */
|
||||
|
||||
#include FORMS_H_LOCATION
|
||||
#include <cstdlib>
|
||||
#include "lyx_sendfax.h"
|
||||
|
||||
FD_xsendfax *create_form_xsendfax(void)
|
||||
{
|
||||
FL_OBJECT *obj;
|
||||
FD_xsendfax *fdui = (FD_xsendfax *) fl_calloc(1, sizeof(FD_xsendfax));
|
||||
|
||||
fdui->xsendfax = fl_bgn_form(FL_NO_BOX, 600, 330);
|
||||
obj = fl_add_box(FL_UP_BOX, 0, 0, 600, 330, "");
|
||||
obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 15, 465, 125, "");
|
||||
fl_set_object_color(obj, FL_COL1, FL_COL1);
|
||||
fdui->Input_Phone = obj = fl_add_input(FL_NORMAL_INPUT, 90, 30, 377, 30, idex(_("Fax no.:|#F")));fl_set_button_shortcut(obj, scex(_("Fax no.:|#F")), 1);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fdui->Input_Name = obj = fl_add_input(FL_NORMAL_INPUT, 90, 65, 377, 29, idex(_("Dest. Name:|#N")));fl_set_button_shortcut(obj, scex(_("Dest. Name:|#N")), 1);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fdui->Input_Enterprise = obj = fl_add_input(FL_NORMAL_INPUT, 90, 100, 377, 29, idex(_("Enterprise:|#E")));fl_set_button_shortcut(obj, scex(_("Enterprise:|#E")), 1);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fdui->Input_Comment = obj = fl_add_input(FL_MULTILINE_INPUT, 15, 165, 575, 106, "");
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_lalign(obj, FL_ALIGN_TOP_LEFT);
|
||||
fl_set_object_lstyle(obj, FL_NORMAL_STYLE+FL_EMBOSSED_STYLE);
|
||||
fdui->Button_Send = obj = fl_add_button(FL_NORMAL_BUTTON, 20, 290, 180, 30, idex(_("OK|#O")));fl_set_button_shortcut(obj, scex(_("OK|#O")), 1);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_lstyle(obj, FL_BOLD_STYLE);
|
||||
fl_set_object_callback(obj, FaxSendCB, 0);
|
||||
fdui->Button_Cancel = obj = fl_add_button(FL_NORMAL_BUTTON, 400, 290, 180, 30, idex(_("Cancel|^[")));fl_set_button_shortcut(obj, scex(_("Cancel|^[")), 1);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_lstyle(obj, FL_BOLD_STYLE);
|
||||
fl_set_object_callback(obj, FaxCancelCB, 0);
|
||||
fdui->Button_Apply = obj = fl_add_button(FL_NORMAL_BUTTON, 210, 290, 180, 30, idex(_("Apply|#A")));fl_set_button_shortcut(obj, scex(_("Apply|#A")), 1);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_lstyle(obj, FL_BOLD_STYLE);
|
||||
fl_set_object_callback(obj, FaxApplyCB, 0);
|
||||
obj = fl_add_frame(FL_ENGRAVED_FRAME, 485, 30, 105, 100, "");
|
||||
fl_set_object_color(obj, FL_COL1, FL_COL1);
|
||||
obj = fl_add_text(FL_NORMAL_TEXT, 490, 20, 95, 20, _("Phone Book"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
|
||||
fl_set_object_lstyle(obj, FL_BOLD_STYLE);
|
||||
fdui->Button_SPhone = obj = fl_add_button(FL_NORMAL_BUTTON, 490, 45, 15, 15, idex(_("Select from|#S")));fl_set_button_shortcut(obj, scex(_("Select from|#S")), 1);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_lalign(obj, FL_ALIGN_RIGHT);
|
||||
fl_set_object_callback(obj, FaxOpenPhonebookCB, 0);
|
||||
obj = fl_add_button(FL_NORMAL_BUTTON, 490, 65, 15, 15, idex(_("Add to|#t")));fl_set_button_shortcut(obj, scex(_("Add to|#t")), 1);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_lalign(obj, FL_ALIGN_RIGHT);
|
||||
fl_set_object_callback(obj, cb_add_phoneno, 0);
|
||||
obj = fl_add_button(FL_NORMAL_BUTTON, 490, 85, 15, 15, idex(_("Delete from|#D")));fl_set_button_shortcut(obj, scex(_("Delete from|#D")), 1);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_lalign(obj, FL_ALIGN_RIGHT);
|
||||
fl_set_object_callback(obj, cb_delete_phoneno, 0);
|
||||
fdui->pb_save = obj = fl_add_button(FL_NORMAL_BUTTON, 490, 105, 15, 15, idex(_("Save|#V")));fl_set_button_shortcut(obj, scex(_("Save|#V")), 1);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_lalign(obj, FL_ALIGN_RIGHT);
|
||||
fl_set_object_callback(obj, cb_save_phoneno, 0);
|
||||
obj = fl_add_text(FL_NORMAL_TEXT, 15, 5, 100, 20, _("Destination:"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
|
||||
fl_set_object_lstyle(obj, FL_BOLD_STYLE);
|
||||
obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 155, 585, 125, "");
|
||||
fl_set_object_color(obj, FL_COL1, FL_COL1);
|
||||
obj = fl_add_text(FL_NORMAL_TEXT, 15, 145, 85, 20, _("Comment:"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
|
||||
fl_set_object_lstyle(obj, FL_BOLD_STYLE);
|
||||
fl_end_form();
|
||||
|
||||
fdui->xsendfax->fdui = fdui;
|
||||
|
||||
return fdui;
|
||||
}
|
||||
/*---------------------------------------*/
|
||||
|
||||
FD_phonebook *create_form_phonebook(void)
|
||||
{
|
||||
FL_OBJECT *obj;
|
||||
FD_phonebook *fdui = (FD_phonebook *) fl_calloc(1, sizeof(FD_phonebook));
|
||||
|
||||
fdui->phonebook = fl_bgn_form(FL_NO_BOX, 600, 320);
|
||||
obj = fl_add_box(FL_UP_BOX, 0, 0, 600, 320, "");
|
||||
fdui->browser = obj = fl_add_browser(FL_HOLD_BROWSER, 2, 2, 598, 318, "");
|
||||
fl_set_object_lsize(obj, FL_MEDIUM_SIZE);
|
||||
fl_set_object_callback(obj, cb_select_phoneno, 0);
|
||||
fl_end_form();
|
||||
|
||||
fdui->phonebook->fdui = fdui;
|
||||
|
||||
return fdui;
|
||||
}
|
||||
/*---------------------------------------*/
|
||||
|
||||
FD_logfile *create_form_logfile(void)
|
||||
{
|
||||
FL_OBJECT *obj;
|
||||
FD_logfile *fdui = (FD_logfile *) fl_calloc(1, sizeof(FD_logfile));
|
||||
|
||||
fdui->logfile = fl_bgn_form(FL_NO_BOX, 510, 190);
|
||||
obj = fl_add_box(FL_UP_BOX, 0, 0, 510, 190, "");
|
||||
fdui->browser = obj = fl_add_browser(FL_NORMAL_BROWSER, 10, 10, 490, 130, "");
|
||||
fdui->Button_Close = obj = fl_add_button(FL_RETURN_BUTTON, 410, 150, 90, 30, _("Close"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_callback(obj, FaxLogfileCloseCB, 0);
|
||||
fl_end_form();
|
||||
|
||||
fdui->logfile->fdui = fdui;
|
||||
|
||||
return fdui;
|
||||
}
|
||||
/*---------------------------------------*/
|
||||
|
@ -1,58 +0,0 @@
|
||||
/** Header file generated with fdesign **/
|
||||
|
||||
#ifndef FD_xsendfax_h_
|
||||
#define FD_xsendfax_h_
|
||||
|
||||
/** Callbacks, globals and object handlers **/
|
||||
extern "C" void FaxSendCB(FL_OBJECT *, long);
|
||||
extern "C" void FaxCancelCB(FL_OBJECT *, long);
|
||||
extern "C" void FaxApplyCB(FL_OBJECT *, long);
|
||||
extern "C" void FaxOpenPhonebookCB(FL_OBJECT *, long);
|
||||
extern "C" void cb_add_phoneno(FL_OBJECT *, long);
|
||||
extern "C" void cb_delete_phoneno(FL_OBJECT *, long);
|
||||
extern "C" void cb_save_phoneno(FL_OBJECT *, long);
|
||||
|
||||
extern "C" void cb_select_phoneno(FL_OBJECT *, long);
|
||||
|
||||
extern "C" void FaxLogfileCloseCB(FL_OBJECT *, long);
|
||||
|
||||
|
||||
/**** Forms and Objects ****/
|
||||
typedef struct {
|
||||
FL_FORM *xsendfax;
|
||||
void *vdata;
|
||||
char *cdata;
|
||||
long ldata;
|
||||
FL_OBJECT *Input_Phone;
|
||||
FL_OBJECT *Input_Name;
|
||||
FL_OBJECT *Input_Enterprise;
|
||||
FL_OBJECT *Input_Comment;
|
||||
FL_OBJECT *Button_Send;
|
||||
FL_OBJECT *Button_Cancel;
|
||||
FL_OBJECT *Button_Apply;
|
||||
FL_OBJECT *Button_SPhone;
|
||||
FL_OBJECT *pb_save;
|
||||
} FD_xsendfax;
|
||||
|
||||
extern FD_xsendfax * create_form_xsendfax(void);
|
||||
typedef struct {
|
||||
FL_FORM *phonebook;
|
||||
void *vdata;
|
||||
char *cdata;
|
||||
long ldata;
|
||||
FL_OBJECT *browser;
|
||||
} FD_phonebook;
|
||||
|
||||
extern FD_phonebook * create_form_phonebook(void);
|
||||
typedef struct {
|
||||
FL_FORM *logfile;
|
||||
void *vdata;
|
||||
char *cdata;
|
||||
long ldata;
|
||||
FL_OBJECT *browser;
|
||||
FL_OBJECT *Button_Close;
|
||||
} FD_logfile;
|
||||
|
||||
extern FD_logfile * create_form_logfile(void);
|
||||
|
||||
#endif /* FD_xsendfax_h_ */
|
@ -1,329 +0,0 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <cstdlib>
|
||||
#include FORMS_H_LOCATION
|
||||
#include "debug.h"
|
||||
#include "lyx_sendfax.h"
|
||||
#include "lyx_main.h"
|
||||
#include "lyxrc.h"
|
||||
#include "support/filetools.h"
|
||||
#include "lyx_gui_misc.h" // CancelCloseBoxCB
|
||||
#include "support/syscall.h"
|
||||
#include "gettext.h"
|
||||
|
||||
using std::endl;
|
||||
|
||||
/* Prototypes */
|
||||
|
||||
bool sendfax(string const & fname, string const & sendcmd);
|
||||
bool button_send(string const & fname, string const & sendcmd = string());
|
||||
|
||||
static
|
||||
void show_logfile(string const & logfile, bool show_if_empty);
|
||||
|
||||
const int LEN_PHONE = 20;
|
||||
const int LEN_NAME = 25;
|
||||
|
||||
/* Global Variables */
|
||||
|
||||
string phone_book;
|
||||
string global_sendcmd;
|
||||
string filename;
|
||||
|
||||
FD_xsendfax * fd_xsendfax;
|
||||
FD_phonebook * fd_phonebook;
|
||||
FD_logfile * fd_logfile;
|
||||
|
||||
|
||||
bool send_fax(string const & fname, string const & sendcmd)
|
||||
{
|
||||
// I put FAXCMD here to see if I can get rid of some strange errors. (Lgb)
|
||||
string FAXCMD = "sendfax -n -h '$$Host' -c '$$Comment' -x '$$Enterprise' -d '$$Name'@'$$Phone' '$$FName'";
|
||||
string title = _("Fax File: ");
|
||||
string path;
|
||||
|
||||
if (fname.empty())
|
||||
return false;
|
||||
path = OnlyPath(fname);
|
||||
if (path.empty() || path == "./")
|
||||
filename = lyx::getcwd() /*GetCWD()*/ + "/" + fname;
|
||||
else
|
||||
filename = fname;
|
||||
|
||||
if (sendcmd.empty())
|
||||
global_sendcmd = FAXCMD;
|
||||
else
|
||||
global_sendcmd = sendcmd;
|
||||
|
||||
fd_xsendfax = create_form_xsendfax();
|
||||
fd_phonebook = create_form_phonebook();
|
||||
fd_logfile = create_form_logfile();
|
||||
|
||||
// Make sure the close box doesn't kill LyX when being pressed. (RvdK)
|
||||
fl_set_form_atclose(fd_xsendfax->xsendfax, CancelCloseBoxCB, 0);
|
||||
fl_set_form_atclose(fd_phonebook->phonebook, CancelCloseBoxCB, 0);
|
||||
fl_set_form_atclose(fd_logfile->logfile, CancelCloseBoxCB, 0);
|
||||
|
||||
/* init Phone-Book */
|
||||
string phone_book_name;
|
||||
if (lyxrc.phone_book.empty()) {
|
||||
phone_book_name = "phonebook";
|
||||
} else
|
||||
phone_book_name = lyxrc.phone_book;
|
||||
phone_book= FileSearch(user_lyxdir, phone_book_name);
|
||||
if (phone_book.empty())
|
||||
phone_book = AddName(user_lyxdir, phone_book_name);
|
||||
|
||||
fl_set_browser_fontsize(fd_phonebook->browser, FL_NORMAL_SIZE);
|
||||
fl_set_browser_fontstyle(fd_phonebook->browser, FL_FIXED_STYLE);
|
||||
fl_load_browser(fd_phonebook->browser, phone_book.c_str());
|
||||
|
||||
title += OnlyFilename(fname);
|
||||
|
||||
/* show the first form */
|
||||
fl_show_form(fd_xsendfax->xsendfax,
|
||||
FL_PLACE_MOUSE | FL_FREE_SIZE, FL_TRANSIENT,
|
||||
title.c_str());
|
||||
/*
|
||||
while(true) {
|
||||
obj = fl_do_forms();
|
||||
if (obj == fd_xsendfax->Button_Cancel)
|
||||
break;
|
||||
else if (obj == fd_xsendfax->Button_Send) {
|
||||
if (button_send(fname, global_sendcmd))
|
||||
break;
|
||||
} else if (obj == fd_xsendfax->Button_Apply) {
|
||||
button_send(fname, global_sendcmd);
|
||||
} else if (obj == fd_xsendfax->Button_SPhone) {
|
||||
cb_select_phoneno(0, 0);
|
||||
}
|
||||
}
|
||||
fl_hide_form(fd_xsendfax->xsendfax);
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool button_send(string const & fname, string const & sendcmd)
|
||||
{
|
||||
string name = fl_get_input(fd_xsendfax->Input_Name);
|
||||
string phone = fl_get_input(fd_xsendfax->Input_Phone);
|
||||
string enterprise = fl_get_input(fd_xsendfax->Input_Enterprise);
|
||||
string comment = fl_get_input(fd_xsendfax->Input_Comment);
|
||||
string host = GetEnv("FAX_SERVER");
|
||||
|
||||
if (phone.empty())
|
||||
return false;
|
||||
string logfile = lyx::tempName(OnlyPath(fname), "FAX"); //TmpFileName(OnlyPath(fname), "FAX");
|
||||
string cmd = sendcmd + " >";
|
||||
cmd += logfile + " 2>";
|
||||
cmd += logfile;
|
||||
cmd = subst(cmd, "$$Host", host);
|
||||
cmd = subst(cmd, "$$Comment", comment);
|
||||
cmd = subst(cmd, "$$Enterprise", enterprise);
|
||||
cmd = subst(cmd, "$$Name", name);
|
||||
cmd = subst(cmd, "$$Phone", phone);
|
||||
cmd = subst(cmd, "$$FName", fname);
|
||||
lyxerr << "CMD: " << cmd << endl;
|
||||
Systemcalls one(Systemcalls::System, cmd);
|
||||
show_logfile(logfile, false);
|
||||
lyx::unlink(logfile);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void cb_hide_form(FL_OBJECT * ob, long)
|
||||
{
|
||||
fl_hide_form(ob->form);
|
||||
}
|
||||
|
||||
|
||||
void cb_select_phoneno(FL_OBJECT *, long)
|
||||
{
|
||||
int n = fl_get_browser_maxline(fd_phonebook->browser);
|
||||
|
||||
fl_hide_form(fd_phonebook->phonebook);
|
||||
char const * line = fl_get_browser_line(fd_phonebook->browser, 1);
|
||||
if (!n || strstr(line, _("Empty Phonebook"))) {
|
||||
fl_clear_browser(fd_phonebook->browser);
|
||||
return;
|
||||
}
|
||||
int i = fl_get_browser(fd_phonebook->browser);
|
||||
line = fl_get_browser_line(fd_phonebook->browser, i);
|
||||
if (!line)
|
||||
return;
|
||||
char * buf = new char [strlen(line)+1];
|
||||
|
||||
strcpy(buf, line);
|
||||
for(i = LEN_PHONE; (i > 0) && (buf[i] == ' '); --i)
|
||||
;
|
||||
buf[i + 1] = 0;
|
||||
for(i = LEN_PHONE + LEN_NAME + 1; (i > LEN_PHONE) && (buf[i] == ' '); --i)
|
||||
;
|
||||
buf[i + 1] = 0;
|
||||
fl_set_input(fd_xsendfax->Input_Phone, buf);
|
||||
fl_set_input(fd_xsendfax->Input_Name, buf+LEN_PHONE+1);
|
||||
fl_set_input(fd_xsendfax->Input_Enterprise, buf+LEN_PHONE+LEN_NAME+2);
|
||||
delete [] buf;
|
||||
}
|
||||
|
||||
|
||||
void cb_add_phoneno(FL_OBJECT *, long )
|
||||
{
|
||||
char const * phone = fl_get_input(fd_xsendfax->Input_Phone);
|
||||
|
||||
if (!strlen(phone))
|
||||
return;
|
||||
|
||||
char const * name = fl_get_input(fd_xsendfax->Input_Name);
|
||||
char const * enterprise = fl_get_input(fd_xsendfax->Input_Enterprise);
|
||||
|
||||
char * buf = new char [50 + strlen(enterprise)];
|
||||
|
||||
sprintf(buf, "%-*.*s %-*.*s %s",
|
||||
LEN_PHONE, LEN_PHONE, phone,
|
||||
LEN_NAME, LEN_NAME, name,
|
||||
enterprise);
|
||||
int n = fl_get_browser_maxline(fd_phonebook->browser);
|
||||
if (n) {
|
||||
char const * line = fl_get_browser_line(fd_phonebook->browser, 1);
|
||||
if (strstr(line, _("Empty Phonebook"))) {
|
||||
fl_clear_browser(fd_phonebook->browser);
|
||||
n = 0;
|
||||
}
|
||||
}
|
||||
int i = 1;
|
||||
for(; i <= n; ++i) {
|
||||
char const * line = fl_get_browser_line(fd_phonebook->browser, i);
|
||||
if (!strncmp(buf, line, 46))
|
||||
break;
|
||||
}
|
||||
if (i > n) {
|
||||
fl_addto_browser(fd_phonebook->browser, buf);
|
||||
fl_set_object_label(fd_xsendfax->pb_save, _("Save (needed)"));
|
||||
}
|
||||
delete[] buf;
|
||||
}
|
||||
|
||||
|
||||
void cb_delete_phoneno(FL_OBJECT *, long )
|
||||
{
|
||||
char const * phone = fl_get_input(fd_xsendfax->Input_Phone);
|
||||
|
||||
if (!strlen(phone))
|
||||
return;
|
||||
|
||||
char const * name = fl_get_input(fd_xsendfax->Input_Name);
|
||||
char const * enterprise = fl_get_input(fd_xsendfax->Input_Enterprise);
|
||||
|
||||
char * buf = new char [50+strlen(enterprise)];
|
||||
|
||||
sprintf(buf, "%-*.*s %-*.*s %s",
|
||||
LEN_PHONE, LEN_PHONE, phone,
|
||||
LEN_NAME, LEN_NAME, name,
|
||||
enterprise);
|
||||
int n = fl_get_browser_maxline(fd_phonebook->browser);
|
||||
if (n) {
|
||||
char const * line = fl_get_browser_line(fd_phonebook->browser, 1);
|
||||
if (strstr(line, _("Empty Phonebook"))) {
|
||||
fl_clear_browser(fd_phonebook->browser);
|
||||
n = 0;
|
||||
}
|
||||
}
|
||||
int i = 1;
|
||||
for(; i <= n; ++i) {
|
||||
char const * line = fl_get_browser_line(fd_phonebook->browser, i);
|
||||
if (!strncmp(buf, line, 46))
|
||||
break;
|
||||
}
|
||||
if (i <= n) {
|
||||
fl_delete_browser_line(fd_phonebook->browser, i);
|
||||
fl_set_object_label(fd_xsendfax->pb_save, _("Save (needed)"));
|
||||
}
|
||||
delete[] buf;
|
||||
}
|
||||
|
||||
|
||||
void cb_save_phoneno(FL_OBJECT *, long )
|
||||
{
|
||||
FILE * fp = ::fopen(phone_book.c_str(), "w");
|
||||
if (!fp) {
|
||||
WriteAlert(_("Error!"), _("Cannot open phone book: "), phone_book);
|
||||
return;
|
||||
}
|
||||
int n = fl_get_browser_maxline(fd_phonebook->browser);
|
||||
if (n) {
|
||||
char const * line = fl_get_browser_line(fd_phonebook->browser, 1);
|
||||
if (strstr(line, _("Empty Phonebook"))) {
|
||||
fl_clear_browser(fd_phonebook->browser);
|
||||
n = 0;
|
||||
}
|
||||
}
|
||||
int i = 1;
|
||||
for(; i <= n; ++i) {
|
||||
char const * line = fl_get_browser_line(fd_phonebook->browser, i);
|
||||
fprintf(fp, "%s\n", line);
|
||||
}
|
||||
fclose(fp);
|
||||
fl_set_object_label(fd_xsendfax->pb_save, _("Save"));
|
||||
fl_redraw_form(fd_xsendfax->xsendfax);
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
void show_logfile(string const & logfile, bool show_if_empty)
|
||||
{
|
||||
if (logfile.empty())
|
||||
return;
|
||||
if (!fl_load_browser(fd_logfile->browser, logfile.c_str())) {
|
||||
if (!show_if_empty)
|
||||
return;
|
||||
fl_add_browser_line(fd_logfile->browser,
|
||||
_("NO OR EMPTY LOGFILE!"));
|
||||
}
|
||||
if (fd_logfile->logfile->visible) {
|
||||
fl_raise_form(fd_logfile->logfile);
|
||||
} else {
|
||||
fl_show_form(fd_logfile->logfile,
|
||||
FL_PLACE_MOUSE | FL_FREE_SIZE, FL_TRANSIENT,
|
||||
_("Message-Window"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FaxLogfileCloseCB(FL_OBJECT *, long)
|
||||
{
|
||||
fl_hide_form(fd_logfile->logfile);
|
||||
}
|
||||
|
||||
|
||||
void FaxCancelCB(FL_OBJECT *, long)
|
||||
{
|
||||
fl_hide_form(fd_xsendfax->xsendfax);
|
||||
}
|
||||
|
||||
|
||||
void FaxApplyCB(FL_OBJECT *, long)
|
||||
{
|
||||
button_send(filename, global_sendcmd);
|
||||
}
|
||||
|
||||
|
||||
void FaxSendCB(FL_OBJECT *, long)
|
||||
{
|
||||
if (button_send(filename, global_sendcmd))
|
||||
FaxCancelCB(0, 0);
|
||||
}
|
||||
|
||||
|
||||
void FaxOpenPhonebookCB(FL_OBJECT *, long)
|
||||
{
|
||||
int n = fl_get_browser_maxline(fd_phonebook->browser);
|
||||
|
||||
if (!n)
|
||||
fl_addto_browser(fd_phonebook->browser, _("@L@b@cEmpty Phonebook"));
|
||||
fl_show_form(fd_phonebook->phonebook,
|
||||
FL_PLACE_MOUSE | FL_FREE_SIZE, FL_TRANSIENT,
|
||||
_("Phonebook"));
|
||||
}
|
Loading…
Reference in New Issue
Block a user