Final changes for ScreenSaver Preferences app
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7258 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
048f424d11
commit
775cef0314
@ -125,3 +125,13 @@ void
|
|||||||
BScreenSaver::_ReservedScreenSaver8() {
|
BScreenSaver::_ReservedScreenSaver8() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
void ReservedScreenSaver1__12BScreenSaver () {}
|
||||||
|
void ReservedScreenSaver2__12BScreenSaver () {}
|
||||||
|
void ReservedScreenSaver3__12BScreenSaver () {}
|
||||||
|
void ReservedScreenSaver4__12BScreenSaver () {}
|
||||||
|
void ReservedScreenSaver5__12BScreenSaver () {}
|
||||||
|
void ReservedScreenSaver6__12BScreenSaver () {}
|
||||||
|
void ReservedScreenSaver7__12BScreenSaver () {}
|
||||||
|
void ReservedScreenSaver8__12BScreenSaver () {}
|
||||||
|
}
|
||||||
|
@ -61,28 +61,30 @@ bool ScreenSaverPrefs::parseSettings (BMessage *msg) {
|
|||||||
msg->FindRect("windowframe",&windowFrame);
|
msg->FindRect("windowframe",&windowFrame);
|
||||||
msg->FindBool("lockenable",&lockenable);
|
msg->FindBool("lockenable",&lockenable);
|
||||||
msg->FindString("lockmethod",&strPtr);
|
msg->FindString("lockmethod",&strPtr);
|
||||||
isNetworkPWD=(strcmp("custom",strPtr));
|
if (strPtr) {
|
||||||
// Get the password. Either from the settings file or the networking file.
|
isNetworkPWD=(strcmp("custom",strPtr));
|
||||||
if (isNetworkPWD) {
|
// Get the password. Either from the settings file or the networking file.
|
||||||
status_t found=find_directory(B_USER_SETTINGS_DIRECTORY,&path);
|
if (isNetworkPWD) {
|
||||||
if (found==B_OK) {
|
status_t found=find_directory(B_USER_SETTINGS_DIRECTORY,&path);
|
||||||
FILE *networkFile=NULL;
|
if (found==B_OK) {
|
||||||
char buffer[512],*start;
|
FILE *networkFile=NULL;
|
||||||
strncpy(pathAndFile,path.Path(),B_PATH_NAME_LENGTH-1);
|
char buffer[512],*start;
|
||||||
strncat(pathAndFile,"/network",B_PATH_NAME_LENGTH-1);
|
strncpy(pathAndFile,path.Path(),B_PATH_NAME_LENGTH-1);
|
||||||
// This ugly piece opens the networking file and reads the password, if it exists.
|
strncat(pathAndFile,"/network",B_PATH_NAME_LENGTH-1);
|
||||||
if ((networkFile=fopen(pathAndFile,"r")))
|
// This ugly piece opens the networking file and reads the password, if it exists.
|
||||||
while (buffer==fgets(buffer,512,networkFile))
|
if ((networkFile=fopen(pathAndFile,"r")))
|
||||||
if ((start=strstr(buffer,"PASSWORD =")))
|
while (buffer==fgets(buffer,512,networkFile))
|
||||||
strncpy(password, start+10,strlen(start-11));
|
if ((start=strstr(buffer,"PASSWORD =")))
|
||||||
|
strncpy(password, start+10,strlen(start-11));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
else {
|
||||||
else {
|
msg->FindString("lockpassword",&strPtr);
|
||||||
msg->FindString("lockpassword",&strPtr);
|
if (strPtr)
|
||||||
if (strPtr)
|
strncpy(password,strPtr,B_PATH_NAME_LENGTH-1);
|
||||||
strncpy(password,strPtr,B_PATH_NAME_LENGTH-1);
|
}
|
||||||
}
|
} else
|
||||||
|
password[0]='\0';
|
||||||
if (B_OK != msg->FindString("modulename",&strPtr))
|
if (B_OK != msg->FindString("modulename",&strPtr))
|
||||||
blankTime=-1; // If the module doesn't exist, never blank.
|
blankTime=-1; // If the module doesn't exist, never blank.
|
||||||
if (strPtr)
|
if (strPtr)
|
||||||
@ -96,8 +98,8 @@ bool ScreenSaverPrefs::parseSettings (BMessage *msg) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenSaverPrefs::SaveSettings (void) {
|
BMessage *ScreenSaverPrefs::GetSettings (void) {
|
||||||
BMessage msg;
|
msg.MakeEmpty();
|
||||||
msg.AddRect("windowframe",windowFrame);
|
msg.AddRect("windowframe",windowFrame);
|
||||||
msg.AddInt32("windowtab",windowTab);
|
msg.AddInt32("windowtab",windowTab);
|
||||||
msg.AddInt32("timeflags",timeFlags);
|
msg.AddInt32("timeflags",timeFlags);
|
||||||
@ -113,9 +115,15 @@ void ScreenSaverPrefs::SaveSettings (void) {
|
|||||||
BString stateMsgName("modulesettings_");
|
BString stateMsgName("modulesettings_");
|
||||||
stateMsgName+=moduleName;
|
stateMsgName+=moduleName;
|
||||||
msg.AddMessage(stateMsgName.String(),&stateMsg);
|
msg.AddMessage(stateMsgName.String(),&stateMsg);
|
||||||
|
return &msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScreenSaverPrefs::SaveSettings (void) {
|
||||||
|
GetSettings();
|
||||||
BPath path;
|
BPath path;
|
||||||
find_directory(B_USER_SETTINGS_DIRECTORY,&path);
|
find_directory(B_USER_SETTINGS_DIRECTORY,&path);
|
||||||
path.Append("OBOS_Screen_Saver",true);
|
path.Append("ScreenSaver_settings",true);
|
||||||
BFile file(path.Path(),B_READ_WRITE | B_CREATE_FILE | B_ERASE_FILE);
|
BFile file(path.Path(),B_READ_WRITE | B_CREATE_FILE | B_ERASE_FILE);
|
||||||
msg.Flatten(&file);
|
if ((file.InitCheck()!=B_OK) || (msg.Flatten(&file)!=B_OK))
|
||||||
|
printf ("Problem with saving preferences file!\n");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user