bool PrefWindow::QuitRequested() { if (!fDirty) return true; BAlert *alert = new BAlert("", B_TRANSLATE("Save changes to this settings panel?"), B_TRANSLATE("Cancel"), B_TRANSLATE("Don't save"), B_TRANSLATE("Save"), B_WIDTH_AS_USUAL, B_OFFSET_SPACING, B_WARNING_ALERT); alert->SetShortcut(0, B_ESCAPE); alert->SetShortcut(1, 'd'); alert->SetShortcut(2, 's'); int32 index = alert->Go(); if (index == 0) return false; if (index == 2) _Save(); else _Revert(); return true; }
bool ApplicationTypeWindow::QuitRequested() { if (_NeedsSaving(CHECK_ALL) != 0) { BAlert* alert = new BAlert(B_TRANSLATE("Save request"), B_TRANSLATE("Save changes before closing?"), B_TRANSLATE("Cancel"), B_TRANSLATE("Don't save"), B_TRANSLATE("Save"), B_WIDTH_AS_USUAL, B_OFFSET_SPACING, B_WARNING_ALERT); alert->SetShortcut(0, B_ESCAPE); alert->SetShortcut(1, 'd'); alert->SetShortcut(2, 's'); int32 choice = alert->Go(); switch (choice) { case 0: return false; case 1: break; case 2: _Save(); break; } } be_app->PostMessage(kMsgTypeWindowClosed); return true; }
bool ShortcutsWindow::QuitRequested() { bool ret = true; if (fKeySetModified) { BAlert* alert = new BAlert(WARNING, B_TRANSLATE("Save changes before closing?"), B_TRANSLATE("Cancel"), B_TRANSLATE("Don't save"), B_TRANSLATE("Save")); alert->SetShortcut(0, B_ESCAPE); alert->SetShortcut(1, 'd'); alert->SetShortcut(2, 's'); switch(alert->Go()) { case 0: ret = false; break; case 1: ret = true; break; case 2: // Save: automatically if possible, otherwise go back and open // up the file requester if (fLastSaved.InitCheck() == B_OK) { if (_SaveKeySet(fLastSaved) == false) { BAlert* alert = new BAlert(ERROR, B_TRANSLATE("Shortcuts was unable to save your " "KeySet file!"), B_TRANSLATE("Oh no")); alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); ret = true; //quit anyway } } else { PostMessage(SAVE_KEYSET); ret = false; } break; } } if (ret) { fColumnListView->DeselectAll(); // Save the window position. entry_ref ref; if (_GetWindowSettingsFile(&ref)) { BEntry entry(&ref); _SaveWindowSettings(entry); } } return ret; }
void PProjectWindow::RemoveSelected() { int s = 0; do { if (fList->IsItemSelected(s)) { PProjectItem* projectItem = dynamic_cast<PProjectItem*>(fList->RemoveItem(s)); if (projectItem) { CProjectGroupItem* projectGroupItem = dynamic_cast<CProjectGroupItem*>(projectItem->ModelItem()); if (projectGroupItem) { BAlert* alert = new BAlert( "Pe message", "You can't remove a group-item", "Ah, Ok", NULL, NULL, B_WIDTH_AS_USUAL, B_OFFSET_SPACING, B_WARNING_ALERT); alert->SetShortcut( 0, B_ESCAPE); alert->Go(); return; } else { fPrjFile->RemoveItem(projectItem->ModelItem()); delete projectItem; SetDirty(true); } } } } while (fList->IsItemSelected(s) || ((s = fList->CurrentSelection(s)) > 0 && s < fList->CountItems())); }
bool MainWindow::QuitRequested() { bool downloading = !static_cast<TorrentorApp*>(be_app)->TorrentList().IsEmpty(); // // // //for (int32 i = fTorrentList.CountItems(); i > 0; i--) { // const TorrentObject* torrent = fTorrentList.ItemAt(i); // // active |= torrent->IsActive(); //} // if (downloading) { BAlert* confirmAlert = new BAlert("", B_TRANSLATE("Quit Torrentor!?"), B_TRANSLATE("Cancel"), B_TRANSLATE("Quit"), NULL, B_WIDTH_AS_USUAL, B_OFFSET_SPACING, B_WARNING_ALERT); confirmAlert->SetShortcut(0, B_ESCAPE); if (confirmAlert->Go() == 0) return false; } be_app->PostMessage(B_QUIT_REQUESTED); return true; }
void ReplicantView::AboutRequested() { BAlert* alert = new BAlert("QueryWatcher", "QueryWatcher 1.0\nBy Michael Armida\[email protected]", "Gee...Thanks"); alert->SetShortcut(0, B_ESCAPE); alert->Go(); }
void AboutRequested() { // FIXME use BAboutBox BString text("FRiSS Version "); text << version(); text << "\n"; text << "\xC2\xA9""2010-2013 Adrien Destugues (PulkoMandy)\n"; text << "\[email protected]\n\n"; text << "\xC2\xA9""2004 Andreas Herzig (N3S)\n"; text << "\[email protected]\n\n"; text << "Original idea:\n\t0033\n\n"; // FIXME translation credits #if 0 if (config!= NULL && config->Lang.Compare("enDE") != 0) { text << _T("Language") << ": " << _T("FL:Language") << "\n"; text << "\t" << _T("FL:Translator") << "\n"; } #endif BAlert* alert = new BAlert("About fRiSS", text.String(), _T("Ok")); alert->SetShortcut( 0, B_ESCAPE ); alert->Go(); }
status_t ScreenshotWindow::_SaveScreenshot() { if (!fScreenshot || !fLastSelectedPath) return B_ERROR; BPath path(_GetDirectory()); if (path == NULL) return B_ERROR; path.Append(fNameControl->Text()); BEntry entry; entry.SetTo(path.Path()); if (entry.Exists()) { BAlert* overwriteAlert = new BAlert( B_TRANSLATE("overwrite"), B_TRANSLATE("This file already exists.\n Are you sure you would " "like to overwrite it?"), B_TRANSLATE("Cancel"), B_TRANSLATE("Overwrite"), NULL, B_WIDTH_AS_USUAL, B_EVEN_SPACING, B_WARNING_ALERT); overwriteAlert->SetShortcut(0, B_ESCAPE); if (overwriteAlert->Go() == 0) return B_CANCELED; } return fUtility.Save(fScreenshot, path.Path(), fImageFileType); }
void TouchpadView::MouseUp(BPoint point) { if (!fXTracking && !fYTracking) return; fXTracking = false; fYTracking = false; const float kSoftScrollLimit = 0.7; int32 result = 0; if (GetRightScrollRatio() > kSoftScrollLimit || GetBottomScrollRatio() > kSoftScrollLimit) { BAlert* alert = new BAlert(B_TRANSLATE("Please confirm"), B_TRANSLATE("The new scroll area is very large and may impede " "normal mouse operation. Do you really want to change it?"), B_TRANSLATE("OK"), B_TRANSLATE("Cancel"), NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); alert->SetShortcut(1, B_ESCAPE); result = alert->Go(); } if (result == 0) { BMessage msg(SCROLL_AREA_CHANGED); Invoke(&msg); } else { if (GetRightScrollRatio() > kSoftScrollLimit) fXScrollRange = fOldXScrollRange; if (GetBottomScrollRatio() > kSoftScrollLimit) fYScrollRange = fOldYScrollRange; DrawSliders(); } }
bool FaberWindow::QuitRequested() { if (ProjectManager::HasChanged()) { BString alertText = "Save changes to "; alertText << ProjectManager::Name(); alertText << "?"; BAlert* alert = new BAlert("Warning!", alertText.String(), "Cancel", "Don't save", "Save", B_WIDTH_AS_USUAL, B_OFFSET_SPACING, B_WARNING_ALERT); alert->SetShortcut(0, B_ESCAPE); int32 button_index = alert->Go(); if (button_index == 2) { BMessenger msg(this); // TODO add Builder-like methods to build commands. BMessage* command = CommandBuilder(FABER_SAVE_PROJECT); command->AddBool("faber:quit", true); msg.SendMessage(command); return false; } else if (button_index == 0) return false; } be_app->PostMessage(B_QUIT_REQUESTED); return true; }
bool PDocument::QuitRequested(void) { TRACE(); //check modified if there are changes wich we need to save bool returnValue = true; bool readLock = false; if (modified) { readLock = Lock(); BAlert *myAlert = new BAlert("title", "Save changes to ...", _T("Cancel"), _T("Don't save"), _T("Save"), B_WIDTH_AS_USUAL, B_OFFSET_SPACING, B_WARNING_ALERT); myAlert->SetShortcut(0, B_ESCAPE); int32 button_index = myAlert->Go(); if (button_index == 0) returnValue = false; else if (button_index == 1) returnValue = true; else { Save(); returnValue = true; } if (readLock) Unlock(); } if (returnValue) { window->Lock(); window->Quit(); } return returnValue; }
bool ShowImageWindow::_ClosePrompt() { if (!fModified) return true; int32 count = fNavigator.PageCount(); int32 page = fNavigator.CurrentPage(); BString prompt; if (count > 1) { bs_printf(&prompt, B_TRANSLATE("The document '%s' (page %d) has been changed. Do you " "want to close the document?"), fImageView->Image()->name, page); } else { bs_printf(&prompt, B_TRANSLATE("The document '%s' has been changed. Do you want to " "close the document?"), fImageView->Image()->name); } BAlert* alert = new BAlert(B_TRANSLATE("Close document"), prompt.String(), B_TRANSLATE("Cancel"), B_TRANSLATE("Close")); alert->SetShortcut(0, B_ESCAPE); if (alert->Go() == 0) { // Cancel return false; } // Close fModified = false; return true; }
static int ShowMessage(char* string) { BAlert *alert = new BAlert("Message", string, "OK"); alert->SetShortcut(1, B_ESCAPE); return alert->Go(); }
bool RealNameAttributeText::CommitEditedTextFlavor(BTextView* textView) { const char* text = textView->Text(); BEntry entry(fModel->EntryRef()); if (entry.InitCheck() != B_OK) return false; BDirectory parent; if (entry.GetParent(&parent) != B_OK) return false; bool removeExisting = false; if (parent.Contains(text)) { BAlert* alert = new BAlert("", B_TRANSLATE("That name is already taken. " "Please type another one."), B_TRANSLATE("Replace other file"), B_TRANSLATE("OK"), NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); alert->SetShortcut(0, 'r'); if (alert->Go()) return false; removeExisting = true; } // TODO: // use model-flavor specific virtuals for all of these special // renamings status_t result; if (fModel->IsVolume()) { BVolume volume(fModel->NodeRef()->device); result = volume.InitCheck(); if (result == B_OK) { RenameVolumeUndo undo(volume, text); result = volume.SetName(text); if (result != B_OK) undo.Remove(); } } else { if (fModel->IsQuery()) { BModelWriteOpener opener(fModel); ASSERT(fModel->Node()); MoreOptionsStruct::SetQueryTemporary(fModel->Node(), false); } RenameUndo undo(entry, text); result = entry.Rename(text, removeExisting); if (result != B_OK) undo.Remove(); } return result == B_OK; }
bool NetworkWindow::QuitRequested(void) { if (fSave->IsEnabled() == true) { BAlert *alert = new BAlert("Save Info Alert", "Save changes before " quitting?", "Don't Save", "Cancel", "Save"); alert->SetShortcut(1, B_ESCAPE); int32 result = alert->Go(); switch (result) { case 0: { // Don't Save break; } case 1:{ // Cancel return false; break; } case 2:{ // Save SaveBackup(NULL,fData); break; } default: break; } }
// check and see if the message needs saving, and whether to ditch it or not bool AwayEditorWindow::CheckMessage() { if( !hasSelection ) return true; BAlert* alert; if( isDirty || genView->textview->IsDirty() ) { alert = new BAlert("", Language.get("AME_SAVE_CHANGES"), Language.get("CANCEL_LABEL"), Language.get("IGNORE_LABEL"), Language.get("SAVE_LABEL"), B_WIDTH_AS_USUAL, B_OFFSET_SPACING, B_WARNING_ALERT); alert->SetShortcut( 0, B_ESCAPE ); int32 index = alert->Go(); if( index == 2 ) if( SaveMessage() ) return true; else return false; if( index == 1 ) { if( currentMsg == BString(Language.get("AME_NEW_MESSAGE")) ) DeleteMessage(); } if( index == 0 ) { Revert(); return false; } } return true; }
void ScreenApplication::AboutRequested() { BAlert *aboutAlert = new BAlert("About", "Screen preferences by the Antares team", "OK", NULL, NULL, B_WIDTH_AS_USUAL, B_OFFSET_SPACING, B_INFO_ALERT); aboutAlert->SetShortcut(0, B_OK); aboutAlert->Go(); }
void ScreenApplication::AboutRequested() { BAlert *aboutAlert = new BAlert(B_TRANSLATE("About"), B_TRANSLATE("Screen preferences by the Haiku team"), B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_OFFSET_SPACING, B_INFO_ALERT); aboutAlert->SetShortcut(0, B_OK); aboutAlert->Go(); }
void GenesisCopyWindow::Copy(const char *filename, const char *destination, const char *destfilename) //////////////////////////////////////////////////////////////////////// { BEntry sourcefile(filename); BString text; if (sourcefile.InitCheck()==B_OK) { /* BString text; text.SetTo(""); text << filename << "\n" << destination; BAlert *myAlert = new BAlert("Copy debug",text.String(),"OK", NULL, NULL, B_WIDTH_AS_USUAL, B_OFFSET_SPACING, B_WARNING_ALERT); myAlert->Go(); */ if (sourcefile.IsDirectory()) { if (IsRecursiveCopy(filename, destination)) { BString text; text << "Recursive copy not allowed.\nPlease check the destination folder."; BAlert *myAlert = new BAlert("Copy",text.String(),"OK", NULL, NULL, B_WIDTH_AS_USUAL, B_OFFSET_SPACING, B_WARNING_ALERT); myAlert->Go(); Close(); kill_thread(m_CopyThread); } CopyDirectory(filename, destination, destfilename); } else if (sourcefile.IsSymLink()) CopyLink(filename,destination, destfilename); else CopyFile(filename, destination, destfilename); } else if (!m_SkipAllCopyError) { text << "Error while initializing file:\n\n" << filename; BAlert *myAlert = new BAlert("Copy",text.String(),"Abort","Skip all","Skip",B_WIDTH_AS_USUAL,B_OFFSET_SPACING,B_WARNING_ALERT); myAlert->SetShortcut(0, B_ESCAPE); switch (myAlert->Go()) { case 0: Close(); kill_thread(m_CopyThread); break; case 1: m_SkipAllCopyError = true; break; } } }
int32 TFilePanel::ShowCenteredAlert(const char* text, const char* button1, const char* button2, const char* button3) { BAlert* alert = new BAlert("", text, button1, button2, button3, B_WIDTH_AS_USUAL, B_WARNING_ALERT); alert->MoveTo(Frame().left + 10, Frame().top + 10); #if 0 if (button1 != NULL && !strncmp(button1, "Cancel", 7)) alert->SetShortcut(0, B_ESCAPE); else if (button2 != NULL && !strncmp(button2, "Cancel", 7)) alert->SetShortcut(1, B_ESCAPE); else if (button3 != NULL && !strncmp(button3, "Cancel", 7)) alert->SetShortcut(2, B_ESCAPE); #endif return alert->Go(); }
void JoyWin::_ShowNoDeviceConnectedMessage(const char* joy, const char* port) { BString str("There does not appear to be a "); str << joy << " device connected to the port '" << port << "'."; BAlert *alert = new BAlert("test1", str.String(), "Stop"); alert->SetShortcut(0, B_ENTER); alert->Go(); }
int32 InfoAlert(char *theError) { int32 result; BAlert *theAlert = new BAlert( "UltraDV", theError, "OK", NULL, NULL, B_WIDTH_FROM_WIDEST, B_WARNING_ALERT); theAlert->SetShortcut(0, B_ESCAPE); result = theAlert->Go(); return (result); }
void JoyWin::_ShowNoCompatibleJoystickMessage() { BString str("There were no compatible joysticks detected on this game"); str << " port. Try another port, or ask the manufacturer of your joystick"; str << " for a driver designed for Haiku or BeOS."; BAlert *alert = new BAlert("test1", str.String(), "OK"); alert->SetShortcut(0, B_ENTER); alert->Go(); }
void BeAIMApplication::PerhapsImport() { BAlert* alert = new BAlert("", Language.get("IB_PERHAPS_IMPORT"), Language.get("NO_LABEL"), Language.get("YES_LABEL"), NULL, B_WIDTH_AS_USUAL, B_EVEN_SPACING, B_WARNING_ALERT); alert->SetShortcut( 0, B_ESCAPE ); if( alert->Go() ) { BMessage* msg = new BMessage(BEAIM_OPEN_SINGLE_WINDOW); msg->AddInt32("wtype", SW_BUDDYLIST_EDITOR); msg->AddBool("doimport", true); windows->OpenSingleWindow(msg); } }
bool PersonWindow::QuitRequested() { status_t result; if (!fView->IsSaved()) { BAlert* alert = new BAlert("", B_TRANSLATE("Save changes before closing?"), B_TRANSLATE("Cancel"), B_TRANSLATE("Don't save"), B_TRANSLATE("Save"), B_WIDTH_AS_USUAL, B_OFFSET_SPACING, B_WARNING_ALERT); alert->SetShortcut(0, B_ESCAPE); alert->SetShortcut(1, 'd'); alert->SetShortcut(2, 's'); result = alert->Go(); if (result == 2) { if (fRef) fView->Save(); else { SaveAs(); return false; } } else if (result == 0) return false; } delete fPanel; BMessage message(M_WINDOW_QUITS); message.AddRect("frame", Frame()); if (be_app->Lock()) { be_app->PostMessage(&message); be_app->Unlock(); } return true; }
bool MainWindow::_CheckSaveIcon(const BMessage* currentMessage) { if (fDocument->IsEmpty() || fDocument->CommandStack()->IsSaved()) return true; // Make sure the user sees us. Activate(); BAlert* alert = new BAlert("save", B_TRANSLATE("Save changes to current icon before closing?"), B_TRANSLATE("Cancel"), B_TRANSLATE("Don't save"), B_TRANSLATE("Save"), B_WIDTH_AS_USUAL, B_OFFSET_SPACING, B_WARNING_ALERT); alert->SetShortcut(0, B_ESCAPE); alert->SetShortcut(1, 'd'); alert->SetShortcut(2, 's'); int32 choice = alert->Go(); switch (choice) { case 0: // cancel return false; case 1: // don't save return true; case 2: default: // cancel (save first) but pick up what we were doing before PostMessage(MSG_SAVE); if (currentMessage != NULL) { delete fMessageAfterSave; fMessageAfterSave = new BMessage(*currentMessage); } return false; } }
void ColumnProperties::SetPrimaryKey(bool key) { fPrimaryKey = key; if (!fPrimaryKey && fAutoNumber) { BString msg("AutoNumber fields are required to be primary keys."); BAlert* alert = new BAlert("Title", msg.String(), "Ok"); alert->SetShortcut(0, B_ESCAPE); alert->Go(); fPrimaryKey = true; } }
void DeskbarPulseView::Remove() { // Remove ourselves from the deskbar by name BDeskbar *deskbar = new BDeskbar(); status_t err = deskbar->RemoveItem("DeskbarPulseView"); if (err != B_OK) { BString str; snprintf(str.LockBuffer(512), 512, B_TRANSLATE("Removing from Deskbar failed.\n%s"), strerror(err)); str.UnlockBuffer(); BAlert *alert = new BAlert(B_TRANSLATE("Info"), str.String(), B_TRANSLATE("OK")); alert->SetShortcut(0, B_ESCAPE); alert->Go(NULL); } delete deskbar; }
status_t CPUButton::Invoke(BMessage *message) { if (!LastEnabledCPU(fCPU)) { _kern_set_cpu_enabled(fCPU, Value()); } else { BAlert *alert = new BAlert(B_TRANSLATE("Info"), B_TRANSLATE("You can't disable the last active CPU."), B_TRANSLATE("OK")); alert->SetShortcut(0, B_ESCAPE); alert->Go(NULL); SetValue(!Value()); } return B_OK; }
MainApp::MainApp() : BApplication(kAppSig), fPlayerCount(0), fSettingsWindow(NULL), fOpenFilePanel(NULL), fSaveFilePanel(NULL), fLastFilePanelFolder(), fMediaServerRunning(false), fMediaAddOnServerRunning(false), fAudioWindowFrameSaved(false), fLastSavedAudioWindowCreationTime(0) { fLastFilePanelFolder = Settings::Default()->FilePanelFolder(); // Now tell the application roster, that we're interested // in getting notifications of apps being launched or quit. // In this way we are going to detect a media_server restart. be_roster->StartWatching(BMessenger(this, this), B_REQUEST_LAUNCHED | B_REQUEST_QUIT); // we will keep track of the status of media_server // and media_addon_server fMediaServerRunning = be_roster->IsRunning(kMediaServerSig); fMediaAddOnServerRunning = be_roster->IsRunning(kMediaServerAddOnSig); if (!fMediaServerRunning || !fMediaAddOnServerRunning) { BAlert* alert = new BAlert("start_media_server", B_TRANSLATE("It appears the media server is not running.\n" "Would you like to start it ?"), B_TRANSLATE("Quit"), B_TRANSLATE("Start media server"), NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); alert->SetShortcut(0, B_ESCAPE); if (alert->Go() == 0) { PostMessage(B_QUIT_REQUESTED); return; } launch_media_server(); fMediaServerRunning = be_roster->IsRunning(kMediaServerSig); fMediaAddOnServerRunning = be_roster->IsRunning(kMediaServerAddOnSig); } }