Warn if Pogger isn't used to open entries
This commit is contained in:
parent
10d03a4803
commit
b2d74a8760
|
@ -53,8 +53,7 @@ EntriesView::MessageReceived(BMessage* msg)
|
||||||
{
|
{
|
||||||
case kEntryFolderText:
|
case kEntryFolderText:
|
||||||
{
|
{
|
||||||
status_t result = ((App*)be_app)->fPreferences->SetEntryDir(
|
status_t result = _SetEntryOpenWith(fEntryFolderText->Text());
|
||||||
fEntryFolderText->Text());
|
|
||||||
if (result != B_OK)
|
if (result != B_OK)
|
||||||
_FileError(result);
|
_FileError(result);
|
||||||
|
|
||||||
|
@ -98,7 +97,7 @@ EntriesView::MessageReceived(BMessage* msg)
|
||||||
{
|
{
|
||||||
BString signature;
|
BString signature;
|
||||||
if (msg->FindString("signature", &signature) == B_OK)
|
if (msg->FindString("signature", &signature) == B_OK)
|
||||||
((App*)be_app)->fPreferences->SetEntryOpenWith(signature.String());
|
_SetEntryOpenWith(signature.String());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case kOpenWithBrowse:
|
case kOpenWithBrowse:
|
||||||
|
@ -116,14 +115,14 @@ EntriesView::MessageReceived(BMessage* msg)
|
||||||
{
|
{
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
if (msg->HasRef("refs") && msg->FindRef("refs", &ref) == B_OK
|
if (msg->HasRef("refs") && msg->FindRef("refs", &ref) == B_OK
|
||||||
&& ((App*)be_app)->fPreferences->SetEntryOpenWith(
|
&& _SetEntryOpenWith(BPath(&ref).Path()) == B_OK)
|
||||||
BPath(&ref).Path()) == B_OK)
|
|
||||||
{
|
{
|
||||||
BMenuItem* prefItem = new BMenuItem(BPath(&ref).Path(),
|
BMessage* prefMsg = new BMessage(kOpenWithSelect);
|
||||||
new BMessage(kOpenWithSelect));
|
prefMsg->AddString("signature", BPath(&ref).Path());
|
||||||
|
|
||||||
|
BMenuItem* prefItem = new BMenuItem(BPath(&ref).Path(), prefMsg);
|
||||||
prefItem->SetMarked(true);
|
prefItem->SetMarked(true);
|
||||||
fOpenWithMenu->AddItem(prefItem);
|
fOpenWithMenu->AddItem(prefItem);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
delete fOpenWithPanel;
|
delete fOpenWithPanel;
|
||||||
|
@ -225,6 +224,35 @@ EntriesView::_InitInterface()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
EntriesView::_SetEntryOpenWith(const char* entry)
|
||||||
|
{
|
||||||
|
char systemSig[B_MIME_TYPE_LENGTH];
|
||||||
|
BMimeType entryType("application/x-feed-entry");
|
||||||
|
|
||||||
|
|
||||||
|
if (entryType.GetPreferredApp(systemSig) == B_OK
|
||||||
|
&& (BString(systemSig) != BString("application/x-vnd.Pogger")
|
||||||
|
&& BString(systemSig) != "application/x-vnd.PoggerDaemon"))
|
||||||
|
{
|
||||||
|
BAlert* alert = new BAlert(B_TRANSLATE("Default entry program"),
|
||||||
|
B_TRANSLATE("This program will only be used to open entry files "
|
||||||
|
"if they are first opened with Pogger.\nCurrently, Pogger isn't set "
|
||||||
|
"as the default to open feed entries."),
|
||||||
|
B_TRANSLATE("Ignore"), B_TRANSLATE("Make default"), "",
|
||||||
|
B_WIDTH_AS_USUAL, B_EVEN_SPACING, B_IDEA_ALERT);
|
||||||
|
|
||||||
|
alert->SetShortcut(0, B_ESCAPE);
|
||||||
|
int32 button_index = alert->Go();
|
||||||
|
|
||||||
|
if (button_index == 1)
|
||||||
|
entryType.SetPreferredApp("application/x-vnd.Pogger");
|
||||||
|
}
|
||||||
|
|
||||||
|
return ((App*)be_app)->fPreferences->SetEntryOpenWith(entry);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
EntriesView::_FileError(status_t result)
|
EntriesView::_FileError(status_t result)
|
||||||
{
|
{
|
||||||
|
|
|
@ -41,6 +41,7 @@ public:
|
||||||
private:
|
private:
|
||||||
void _InitInterface();
|
void _InitInterface();
|
||||||
|
|
||||||
|
status_t _SetEntryOpenWith(const char* entry);
|
||||||
void _FileError(status_t result);
|
void _FileError(status_t result);
|
||||||
|
|
||||||
BBox* fSavingBox;
|
BBox* fSavingBox;
|
||||||
|
|
Ŝarĝante…
Reference in New Issue